[MDEV-6261] ANALYZE-driven query optimization Created: 2014-05-22  Updated: 2015-11-17

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Sergei Petrunia Assignee: Igor Babaev
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The idea is to use the data obtained by "ANALYZE statement" (MDEV-406) for query optimization. In order for that to work, we will need to
1. Save the ANALYZE data somewhere where we could access it
2. Reuse that data in optimization

== Saving ANALYZE data ==

After MDEV-406, the data will be saved into the slow query log. The problems are

  • There is no way to read that data back in the server
  • Even if we implement reading, we will only be able to read the file sequentially.

== Reading and reusing the data ==

At the moment the idea is to re-use execution data for re-running the same query. Reuse will go as follows:

  • We get a query
  • We find ANALYZE data for this query (we could also try using ANALYZE data
    from the queries that matched the same query pattern)
  • We optimize the query, making the optimizer to take into account the real
    table read costs and selectivities.
  • This can result in the same query plan or in a different query plan..

TODO: elaborate further.

== Questions ==

  • Do we need to save just the ANALYZE output (i.e. EXPLAIN + actual execution data), or it should be some other kind of data that can be reused by the optimizer? (current answer: just EXPLAIN)
  • How exactly can saved data be used? (Current answer: we have precis selectivity/fanout numbers for the join order that was picked)
  • Do we use data collection/re-feeding for all queries or for some of them only?

Generated at Thu Feb 08 07:10:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.