yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.88k stars 1.05k forks source link

[YSQL] Add support for query plan management #12097

Open sushantrmishra opened 2 years ago

sushantrmishra commented 2 years ago

Jira Link: DB-800

Description

Query plan management main objectives:

Using the query plan management allow control execution plans for a set of statements. You can do the following:

Some open source option to consider.

mtakahar commented 2 years ago

pg_store_plans

  • This is a plan history tracking feature rather than a plan stability tool.
  • This is extremely useful to detect any plan changes and how different plans have performed.
  • We should have something like this as a part of the observability project.

pg_plan_guarantee

  • This tool just prints the plan data structure as a serialized text then the user has to specify that plan text along with the query.
  • Setting aside the poor user interface, saving the raw plan representation is dangerous and will easily break with some schema changes and after an upgrade (especially when we upgrade the postgres, but also possible when some push down feature additions and behavior changes.) The plan representation must not contain any column/table positions or Oids of any kind.

A potential and more intuitive way of fixing the plan for each given query would be to generate and store a set of hints in the hint_plan.hints table.