Two-field index is used, since query time using it is much lower, as expected. ![]() Note: when using != null instead of > null, two-field index is never used, regardless of indexHint. Is it a matter of selectivity ? Both are very high. Two-field index on deleted, date_updated is used. Single-field index on date_updated is used because of sort statement, as if filter on deleted is ignored. Persistent, unique: false, sparse: false, deduplicate: false, estimates: true, selectivity: 99.95% on deleted, date_updated (idx_1706619872398540800, created recently, under ArangoDB 3.7) Steps to reproduce For my version of ArangoDB (3.0.12) the query makes use of a sparse index as well, so there may have been a bugfix for this in 3.0.11 or 3.0.12. If indexes are used just with non-sparse indexes in your ArangoDB version, then the fix is to make the index non-sparse. Skiplist, unique: false, sparse: false, deduplicate: false, estimates: true, selectivity 99.97% on date_updated (idx_10220164868, created a long time ago, probably under ArangoDB 3.4) Ok, the latest explain result shows that the query is using indexes. Users collection has around 2M leted field is either null or a timestamp. Query String (146 chars, cacheable: true):įOR u IN users OPTIONS ĩ IndexNode 2010136 - FOR u IN users LET #3 = u.`date_updated` /* persistent index scan */ /* with late materialization */Ħ SortNode 2010136 - SORT #3 DESC /* sorting strategy: constrained heap */ĩ idx_1706619872398540800 persistent users false false 99.95 % (u.`deleted` > null) Optimization rules with highest execution times: ![]() Query String (97 chars, cacheable: true):ĩ IndexNode 2010136 - FOR u IN users /* reverse skiplist index scan */ FILTER (u.`deleted` > null) /* early pruning */īy Name Type Collection Unique Sparse Selectivity Fields Rangesĩ idx_10220164868 skiplist users false false 99.97 % *
0 Comments
Leave a Reply. |