· Apr 7, 2022

Inserting an index without reconstruction


I'd like to know if there are any issues if an index is inserted into a table without running the %BuildIndices() method.

It's important to note that data inserted before the index is not important for retrieval, so it's not a problem data inserted before the index don't show up in queries.

The reason why I'm asking this is that I'd like to avoid index reconstruction on big tables which I need to inser such index.

I'm using Cache 2018.1.



Product version: Caché 2018.1
Discussion (8)3
Log in or sign up to continue
Is it OK to use this partially rebuilt index if I don't care about data that isn't indexed? Did you do this before?

I didn't build indexes manually, except for tests. If the index is not built for all data, then the query will see only the data for which the index exists.

Try simple example:

If only seeing new data suits your use case, then you are probably ok with this approach.   You may wish to look at %ValidateIndices() which I believe is present in Cache2018.   This will allow an online check of the index state and can either report on mismatches, or be set to autorepair.  It is MUCH slower than a %BuildIndices, but does not require a full freeze for safety