The statement isnβt executed when using ADVISE, only the parsing and planning stages take place. No documents are read or modified.
Which statements can be advised
ADVISE can preface most statements β anything except a nestedEXPLAIN, PROFILE, or ADVISE.
Advice is only produced for statements that scan a collection:
SELECTUPDATEDELETE,EVICT, andTOMBSTONEINSERT ... SELECTβ the advice is derived from the embeddedSELECT
INSERT with literal VALUES β is accepted but returns an outcome of no advice available for statement.
The advice document
The result is a single document with anadvice field containing:
Each recommendation combines the indexable clauses of a statement into as few composite indexes as possible. Keys are ordered as equality keys first, then
ORDER BY keys, then range keys, followed by projected fields when a covering index is worthwhile. Aliased ORDER BY fields are resolved back to the underlying document field.
Examples
A statement with nothing to index on returns anoutcome rather than suggestions:
DQL
DQL
DQL
ADVISE AND PROVISION
Adding the optionalAND PROVISION clause makes ADVISE also create the suggested indexes as part of the same statement:
DQL
createdIndexes (in place of suggestedIndexes):
failedIndexes instead, each entry carrying an error describing why creation failed.
ADVISE is currently supported on the small peer only.