11# Adaptive query optimization
22
33Adaptive query optimization is the extension of standard PostgreSQL cost-based
4- query optimizer. Its basical principle is to use query execution statistics
4+ query optimizer. Its basic principle is to use query execution statistics
55for improving cardinality estimation. Experimental evaluation shows that this
6- improvement sometimes provides an enourmously large speed-up for rather
6+ improvement sometimes provides an enormously large speed-up for rather
77complicated queries.
88
99This extension is under development now, but its main functionality is already
@@ -15,7 +15,7 @@ The module works with PostgreSQL 9.6.
1515
1616The module contains a patch and an extension. Patch has to be applied to the
1717sources of PostgresSQL. Patch affects header files, that is why PostgreSQL
18- must be rebuilded completelly after applying the patch ("make clean" and
18+ must be rebuilt completely after applying the patch ("make clean" and
1919"make install").
2020Extension has to be unpacked into contrib directory and then to be compiled and
2121installed with "make install".
@@ -51,19 +51,19 @@ For handling workloads with dynamically generated query structures the forced
5151mode "aqo.mode = 'forced'" is provided. We cannot guarantee performance
5252improvement with this mode, but you may try it nevertheless.
5353
54- If you want to completelly control how PostgreSQL optimizes queries, use manual
54+ If you want to completely control how PostgreSQL optimizes queries, use manual
5555mode "aqo.mode = 'manual'" and
5656
5757contrib/aqo/learn_queries.sh file_with_sql_queries.sql "psql -d YOUR_DATABASE"
5858
59- where file_with_sql_queries.sql is a textfile with queries on which aqo is
59+ where file_with_sql_queries.sql is a textfile with queries on which AQO is
6060supposed to learn. Please use only SELECT queries file_with_sql_queries.sql.
61- More sophisticated and convenient tool for aqo administration is in the
61+ More sophisticated and convenient tool for AQO administration is in the
6262development now.
6363
64- If you want to freeze optimizer's behaviour (i. e. disable learning under
64+ If you want to freeze optimizer's behavior (i. e. disable learning under
6565workload), use "UPDATE aqo_queries SET auto_tuning=false;".
66- If you want to disable aqo for all queries, you may use
66+ If you want to disable AQO for all queries, you may use
6767"UPDATE aqo_queries SET use_aqo=false, learn_aqo=false, auto_tuning=false;".
6868
6969## Advanced tuning
@@ -81,34 +81,34 @@ structures: it tries to learn separately how to optimize different query types,
8181and for dynamical query structure the query types are different, so it will
8282consume a lot of memory and will not optimize any query properly.
8383
84- Forced mode forces aqo to ignore query types and optimize them together. On one
84+ Forced mode forces AQO to ignore query types and optimize them together. On one
8585hand it lacks of intelligent tuning, so the performance for some queries may
8686even decrease, on the other hand it may work for dynamic workload and consumes
87- less memory than the intellignet mode. That is why you may want to use it.
87+ less memory than the intelligent mode. That is why you may want to use it.
8888
8989Each query type has its own optimization settings. You can find them in table
9090aqo_queries.
9191
92- Auto_tuning setting identifies whether aqo module tries to tune other settings
93- from aqo_queries for the query type. If the mode is intelligent, defalt value
94- for new queries is true. If the mode is not intelligent, new queries are not
95- appended to aqo_queries automatically, but you can also set auto_tuning variable
96- to true manually.
92+ Auto_tuning setting identifies whether AQO module tries to tune other settings
93+ from aqo_queries for the query type on its own . If the mode is intelligent,
94+ default value for new queries is true. If the mode is not intelligent, new queries
95+ are not appended to aqo_queries automatically, but you can also set auto_tuning
96+ variable to true manually.
9797
98- Use_aqo setting shows whether aqo cardinalities prediction be used for next
99- execution of such query type. Disabling of aqo usage is reasonable for that
100- cases in which query execution time increases after applying aqo . It happens
98+ Use_aqo setting shows whether AQO cardinalities prediction be used for next
99+ execution of such query type. Disabling of AQO usage is reasonable for that
100+ cases in which query execution time increases after applying AQO . It happens
101101sometimes because of cost models incompleteness.
102102
103- Learn_aqo setting shows whether aqo collects statistics for next execution of
103+ Learn_aqo setting shows whether AQO collects statistics for next execution of
104104such query type. True value may have computational overheads, but it is
105- essential when aqo model does not fit the data. It happens at the start of aqo
105+ essential when AQO model does not fit the data. It happens at the start of AQO
106106for the new query type or when the data distribution in database is changed.
107107
108- Fspace_hash setting is for extra advanced aqo tuning. It may be changed manually
108+ Fspace_hash setting is for extra advanced AQO tuning. It may be changed manually
109109to optimize a number of query types using the same model. It may decrease the
110110amount of memory for models and even query execution performance, but also it
111- may cause the bad aqo 's behaviour , so please use it only if you know exactly
111+ may cause the bad AQO 's behavior , so please use it only if you know exactly
112112what you do.
113113
114114## Statistics
0 commit comments