Re: Where is the filter?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "jacktby(at)gmail(dot)com" <jacktby(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Where is the filter?
Date: 2023-02-06 16:15:42
Message-ID: CA+TgmoZwdiRZDQbFp+=LHWKz7e-2Pb-+R8eb0tvBUnPxWVfRmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Feb 4, 2023 at 11:29 PM jacktby(at)gmail(dot)com <jacktby(at)gmail(dot)com> wrote:
> When I use 'select * from t where a = 1'; And I debug to find where the 'a = 1' is used,
> when I arrive ExecScan in src/backend/executor/execScan.c, line 158, where this 'a = 1' is
> stored in?

It depends somewhat on what query plan you got. For instance if it was
a Seq Scan then it will be a filter-condition, or "qual", and the call
to ExecQual() later in ExecScan() will be responsible for evaluating
it. But if you are using an index scan, then it will probably become
an index qual, and those are passed down into the index machinery and
internally handled by the index AM. It's a good idea when you're
debugging this sort of thing to start by looking at the EXPLAIN or
EXPLAIN ANALYZE output, and perhaps also the output with
debug_print_plan = true.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2023-02-06 16:17:31 Re: make_ctags: use -I option to ignore pg_node_attr macro
Previous Message Tom Lane 2023-02-06 16:15:13 Re: when the startup process doesn't (logging startup delays)