Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add smart statement timeout for learning AQO. #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Alena0704 wants to merge 2 commits into stable15 from stable15-smart_statement_timeout

Conversation

Copy link
Collaborator

@Alena0704 Alena0704 commented Jan 20, 2023

AQO evaluates to have an enough time for training by the average integral error. If the integral error hasn't changed for comparing with error from the previous iteration, we increase the training time exponentially.
Start value of smart statement timeout as equal as aqo_statement timeout or 0. If the user needs an upper limit on query execution time, he can set a vanilla statement timeout setting aqo_statement_timeout as 0. Smart statement timeout in this option is unenabled. The aqo.statement_timeout value is stored in aqo_queries. Initially it equals as 0 (default value). The user has the ability to specify the GUC aqo.statement_timeout and terminates the request by analogy with statement timeout.

Copy link
Collaborator

@danolivo danolivo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


\echo Use "ALTER EXTENSION aqo UPDATE TO '1.4'" to load this file. \quit

ALTER TABLE public.aqo_data ADD COLUMN reliability double precision [];
ALTER TABLE public.aqo_queries ADD COLUMN smart_timeout bigint;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем вносить изменения в старые версии AQO? Что подумают люди, у которых уже установлена версия 1.4 ?

Copy link
Collaborator Author

@Alena0704 Alena0704 Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Согласна, убрала.

OUT fs bigint,
OUT learn_aqo boolean,
OUT use_aqo boolean,
OUT auto_tuning boolean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь то же замечание, что и выше. Мы вроде работаем с версией 1.6

Copy link
Collaborator Author

@Alena0704 Alena0704 Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Перенесла изменение в aqo--1.5--1.6.sql.


ALTER TABLE public.aqo_data ADD COLUMN reliability double precision [];
ALTER TABLE public.aqo_queries ADD COLUMN smart_timeout bigint;
ALTER TABLE public.aqo_queries ADD COLUMN count_increase_timeout bigint;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если хочется как-то защитить бинарники библиотеки от использования не с той версией системного каталога БД, то можно проверять версии, и если они не совпадают, генерировать WARNING,или что-то вроде того. Но сейчас я бы обошелся без такой защиты.

Copy link
Collaborator Author

@Alena0704 Alena0704 Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Немного не поняла идею, как тут встроить проверку и вывести ошибку. Есть ли пример похожей реализации?


if (aqo_learn_statement_timeout && aqo_statement_timeout > 0)
{
max_timeout_value = Min(query_context.smart_timeout, (int64) aqo_statement_timeout);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему эти два параметра разного типа? В чём смысл?

Copy link
Collaborator Author

@Alena0704 Alena0704 Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Имеют разный смысл. Описала ниже подробней

TimestampTz fin_time;
int64 fintime = (int64) get_timeout_finish_time(STATEMENT_TIMEOUT)-1;

if (aqo_learn_statement_timeout && aqo_statement_timeout > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А не являются ли два гука избыточными?

Copy link
Collaborator Author

@Alena0704 Alena0704 Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предполагалось, изначально, при разработаке фичи, что aqo_statement_timeout устанавливает предел времени выполнения запроса для того, чтобы успеть сохранить данные обучения в таблицу знаний.
aqo_learn_statement_timeout - немного другая на мой взгляд функциональность, так как она включает возможность увеличивать statement_timeout для каждого отдельного запроса, либо пока aqo не прекратит ошибаться, либо пока не достигнем установленного лимита (aqo_statement_timeout или ванильный statement_timeout)

@Alena0704 Alena0704 force-pushed the stable15-smart_statement_timeout branch 2 times, most recently from a8212e9 to f742330 Compare January 25, 2023 07:02
...in through manual retraining.
AQO evaluates whether enough to execute the query through comparison integral error value with its fixed value (0.1),
also if integral error didn't change compared to previous iterations, smart statemet timeout value will be increased.
Besides, smart statemet timeout value won't be increased, if there is reached limit value, namely statement timeout.
The initial smart_statement_timeout value is aqo statement timeout value or 0.
Smart statement timeout value and number of its using are saved in aqo_queries.
@Alena0704 Alena0704 force-pushed the stable15-smart_statement_timeout branch from f742330 to 090d4b6 Compare January 27, 2023 08:14
@danolivo danolivo deleted the stable15-smart_statement_timeout branch February 1, 2023 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@danolivo danolivo danolivo left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /