# Index rebuild

Hi Team,

We have migrated CRDB 19.2 to a different N/W.

after migration queries getting very slow, do we need to recreate the index?

Please guide me.


Hi Raj,

Are specific queries slower or are all queries now slower?

Could you provide more details about the old and new network?

You should not need to recreate any secondary indexes unless they were removed manually during the migration.


HI @nathan,

We did for the below action plan

Replica setting for 6 node cluster - General - Cockroach Labs

The database is up and running fine, But most of the queries getting very slow (2 to 5s).

We have not removed any index in CRDB,


Hi @nathan

Continues for the above issue.

For example::

root@> show index from “employee”;
table_name| index_name | non_unique | seq_in_index | column_name | direction | storing | implicit
employee | PK_d5fdf9e629e6cbce66ab2e8bc | false | 1 | memberId | ASC | false | false
employee | PK_d5fdf9e629e6cbce66ab2e8bc | false | 2 | groupUid | ASC | false | false
employee | IDX_ce94771ea1d09bcafa72fb1d | true | 1 | memberId | ASC | false | false
employee | IDX_ce94771ea1d09bcafa72fb1d | true | 2 | groupUid | ASC | false | true
employee | IDX_af21ef371efe920542e0aeac | true | 1 | groupUid | ASC | false | false
employee | IDX_af21ef371efe920542e0aeac | true | 2 | memberId | ASC | false | true
(6 rows)

Time: 31.214362ms

root@> explain select * from “employee”;
tree | field | description
| distributed | true
| vectorized | false
scan | |
| table | employee@PK_d5fdf9e629e6cbce66ab2e8bc
| spans | ALL
(5 rows)

Time: 4.240231ms

  • We have a secondary index on employee tables, while executing the select query it’s not considering the secondary index. why?
  • spans | ALL → mean full table scan right?

So most of the indexes look the same after migration.



What is the current state of the cluster? Just the three nodes from the new network?

If you’re getting very slow latencies and the “old network” nodes are still in the cluster, I would look to see if the ranges are all on the new nodes.

If you just have the 3 “new network” nodes, I would definitely do a basic ping test between your app nodes and the DB nodes and make sure that you’re getting very fast latencies there.


1 Like

Hi @jimhatcher_crdb ,

All the nodes running in the new network. and Ranges also completed synced in the new network.

Ill check the ping app node to DB node ill update ASAP.

Thanks for the reply ,