The Importance of Temporary Indexes for Ad Hoc Queries
Join the DZone community and get the full member experience.Join For Free
In RavenDB, when you make an query without explicitly specifying which index you want to use, the query optimizer will select one for you. If none is found that can satisfy your query, the query optimizer will create one that matches your query, but it will do so on a temporary basis. That index will function normally, but if it isn’t used, it will be removed after a while. If it is heavily used, it will be converted to a real index.
I was reminded of this today when I realized that I had a bug in our code that caused a value to be misspelled. There were just a few such documents, and I went into the studio and fixed them manually. I had to use a dynamic query to do so, and I was amused to realize that this is the exact scenario for which we built them. An admin doing ad hoc operations, probably to resolve some bug or issue.
Sometimes, just having things work out the way you planned make for a great day. And hey, this is what I was avoiding:
Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Integration Testing Tutorial: A Comprehensive Guide With Examples And Best Practices
WireMock: The Ridiculously Easy Way (For Spring Microservices)
The Role of AI and Programming in the Gaming Industry: A Look Beyond the Tables
VPN Architecture for Internal Networks