Re: question about executor hooks - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: question about executor hooks
Date
Msg-id CAA5RZ0vUUcA4h6tVwwHLsy46Fioy-DMBr1AOHO9LGKNHNH4MjA@mail.gmail.com
Whole thread Raw
In response to Re: question about executor hooks  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
I recommend you to review the documentation in
backend/executor/README. It explains in good detail how
the executor works. Specifically the section "Query Processing Control Flow"
explains what each of the hooks you reference are responsible for.
Also, be aware that there are operations, called utility statements,
that may not go through the executor; i.e. CREATE TABLE t (id int),
will go through ProcessUtility ( also has a hook ) only as it's a utility
statement and not a plannable statement.

As mentioned above, pg_stat_statements is a good reference extension
that implements these hooks for query level executions statistics.

> Moreover, installing an hook is cluster-wide, right? Is there a way to
> limit an hook only for connections related to a single database
> (without taking into account FDW and friends)?

It depends on the hook. pg_stat_statements for example loads the
hooks at startup time, but the extension itself implements a GUC
that allows a user to skip doing any work inside these hooks.

Regards,

Sami



pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: Coccinelle for PostgreSQL development [1/N]: coccicheck.py
Next
From: Yugo NAGATA
Date:
Subject: Re: psql: Add leakproof field to \dAo+ meta-command results