Обсуждение: Where is the filter?

Поиск
Список
Период
Сортировка

Where is the filter?

От
"jacktby@gmail.com"
Дата:

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?

jacktby@gmail.com

Re: Where is the filter?

От
Robert Haas
Дата:
On Sat, Feb 4, 2023 at 11:29 PM jacktby@gmail.com <jacktby@gmail.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