Skip to content

file storage for aqo_query_texts #52

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

Conversation

Andrey2001
Copy link

No description provided.

danolivo and others added 26 commits September 17, 2021 09:09
threads during the stress test on a postgres instance with installed AQO
extension.

This is enough to check correctness of concurrent access to a ML
knowledge base.
Replace a Value node with A_Const (Integer) node because of 639a86e36a.
It is necessary to use AQO with cached plans.

Improve interface of preprocessing module.
where an optimizer don't plan query because it uses an existed plan
from the plancache.
could produce error on missed relation.
Implement careful opening procedure. We should disable AQO in this
backend if any storage relation isn't exists. But, this commit
disables only query.

TAP test on this issue was added at the end of 001_pgbench.pl.
Pointlessly to call it on each planning hook execution.
We realized that plan serialization procedure and operations of
removing substring is heavy. Core serialization code should be redesigned
and rewrited.
Teach add_query_text to check existence of record (or concurrent
insertion) and skip insertion in such case.
It allows us to make simple modifications in the code. Now, we skip
access to database in the DISABLED mode if it is not really
necessary.
Also, reduce a scope of custom lock on a query class in the aqo_planner
and executor_end hooks.
It allows us to play with this status more flexible (Maybe later).
It means that we can store into a shared buffer total execution time,
number of executions, may be another additional information, for
each query. Queries in this buffer are grouped by a query class value
in terms of the AQO extension.
Profiling doesn't require any access to the AQO knowledge base, i.e.
access to DBMS heap. So, here we have no large overhead.
It can be used even in DISABLED mode.

Some new additional interface tools were added:
Two GUCS:
aqo.profile_classes - defines allocated size of shared memory.
aqo.profile_enable - on/off profiling feature.

Functions:
aqo_show_classes - returns list of classes from a profiling buffer.
aqo_clear_classes - clear the profiling buffer.

Main idea and core code implemented by Maxim Belov. Improvements
and tests are made by me.
necessary for a profiling buffer allocation in shared memory.
…eryId

values as pg_stat_statements. It reduces risk of conflicts and allow to use
these extensions in conjunction.

We want to use pg_stat_statements as profiler to switch on and switch off in
controlled mode for the queries.
'aqo_fdw', 'unsupported' regression tests.
the storage for aqo_query_texts was made like storage for pg_stat_statements
@Andrey2001 Andrey2001 changed the title function file_read_query_text file storage for aqo_query_text Dec 13, 2021
@Andrey2001 Andrey2001 changed the title file storage for aqo_query_text file storage for aqo_query_texts Dec 13, 2021
@danolivo
Copy link
Collaborator

Код нормальный. Есть замечания.

  1. Давай сделаем переключение по GUC с табличного стораджа на твой, чтобы можно было безопасно запушить твой код.
  2. Calloc в постгресе не используется - нужен palloc
  3. По функции чтения - нужно читать запись с данным qhash И возвращать query string. В твоем случае это, видимо, означает проход по всем записям и выбор первой, у которой совпадает qhash.

@danolivo danolivo closed this Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants