Description
https://docs.google.com/document/d/11c0LHPi5JCAn7-ROlDIpngbCiDZVLtmO
Initial Ideas:
For advise statement:
Advise index with both relative and full paths when applicable.
- Advise index with relative path for collection when query context is set, provide information of query context, optimize the naming of each output field.
- Advise index only with full path for collection when query context is not set.
For Advisor function for workload:
Advise index with full path.
For advisor function for session handling:
Collect query context for each query coming from system:completed request, apply each individual query context to the query. Recommend index with full path.
advise select id from mycollection where id > 10 and name = "demo"; |
|
"results": [ |
{
|
"#operator": "Advise", |
"advice": { |
"#operator": "IndexAdvice", |
"adviseinfo": { |
"recommended_indexes": { |
"covering_indexes": [ |
{
|
"keyspace_alias": "mycollection", |
"query_context": "default:bucket1.myscope", |
"statement_full": "CREATE INDEX adv_id_name ON `default`:`bucket1`.`myscope`.`mycollection`(`id`) WHERE `name` = 'demo'", |
"statement_relative": "CREATE INDEX adv_id_name ON `mycollection`(`id`) WHERE `name` = 'demo'" |
}
|
],
|
"indexes": [ |
{
|
"keyspace_alias": "mycollection", |
"query_context": "default:bucket1.myscope", |
"recommending_rule": "Index keys follow cost-based order.", |
"statement": "CREATE INDEX adv_id_name ON `default`:`bucket1`.`myscope`.`mycollection`(`id`) WHERE `name` = 'demo'", |
"statement_relative": "CREATE INDEX adv_id_name ON `mycollection`(`id`) WHERE `name` = 'demo'" |
}
|
]
|
}
|
}
|
},
|
"query": "select id from mycollection where id > 10 and name = \"demo\";" |
}
|
]
|
|
Attachments
For Gerrit Dashboard: MB-40083 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
131791,7 | MB-40083 Advisor to support relative path for collection | master | query | Status: MERGED | +2 | +1 |
131792,2 | MB-40083 Advisor to support relative path for collection - 2 | master | query-ee | Status: MERGED | +2 | +1 |
132509,2 | MB-40083 - Update index advice UI for change in format from server. | master | query-ui | Status: MERGED | +2 | +1 |
132766,2 | MB-40083 Revert the changes of naming of index statement | master | query | Status: MERGED | +2 | +1 |
132767,2 | MB-40083 Revert the changes of naming of index statement-2 | master | query-ee | Status: MERGED | +2 | +1 |
135340,2 | MB-40083 - Revert change Icaf4d775351dc10c9f39f8b80d0aef40890f5491 | master | query-ui | Status: MERGED | +2 | +1 |