Written by

Training Sales Engineer at InterSystems Japan
Article Mihoko Iijima · Aug 31, 2023 1m read

How to rebuild index by ID

InterSystems FAQ rubric

By specifying the start and end values ​​of the IDs for which you want to rebuild indexes in the arguments of the %BuildIndices() method provided in the persistent class (=table) definition, you can rebuild only the indexes within that range.

For example, to rebuild the NameIDX index and ZipCode index in the Sample.Person class only for ID=10 to 20, execute the following code (the ID range is specified in the 5th and 6th arguments). 

 set status = ##class(Sample.Person).%BuildIndices($LB("NameIDX","ZipCode"),1,,1,10,20

$LB() is the $ListBuild() function. The %BuildIndices() method uses it to specify the index name.

See the documentation for more info on how to rebuild the index.

 For version 2018.1 please refer to this document.