RE: Improve EXPLAIN output for multicolumn B-Tree Index

From: <Masahiro(dot)Ikeda(at)nttdata(dot)com>
To: <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: <pgsql-hackers(at)lists(dot)postgresql(dot)org>, <Masao(dot)Fujii(at)nttdata(dot)com>
Subject: RE: Improve EXPLAIN output for multicolumn B-Tree Index
Date: 2024-06-26 07:25:26
Message-ID: TYWPR01MB109824F6591DC8C72F32FDDFFB1D62@TYWPR01MB10982.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>=# EXPLAIN (VERBOSE, ANALYZE) SELECT * FROM test WHERE id1 = 1 AND id3 = 101;
>>                                                          QUERY PLAN                                                           
>>-------------------------------------------------------------------------------------------------------------------------------
>> Index Scan using test_idx on ikedamsh.test  (cost=0.42..12630.10 rows=1 width=18) (actual time=0.175..279.819 rows=1 loops=1)
>>   Output: id1, id2, id3, value
>>   Index Cond: (test.id1 = 1)                 -- Change the output. Show only the bound quals.
>>   Index Filter: (test.id3 = 101)              -- New. Output quals which are not used as the bound quals
>>   Rows Removed by Index Filter: 499999    -- New. Output when ANALYZE option is specified
>> Planning Time: 0.354 ms
>> Execution Time: 279.908 ms
>> (7 rows)
>
> I don't think we want to split these clauses. Index Cond should indicate the conditions applied
> to the index scan. Bound quals should be listed separately even though they will have an
> intersection with Index Cond. I am not sure whether Index Filter is the right name,
> maybe Index Bound Cond: But I don't know this area enough to make a final call.

OK, I understood that it's better to only add new ones. I think "Index Filter" fits other than "Index
Bound Cond" if we introduce "Rows Removed By Index Filter".

> About Rows Removed by Index Filter: it's good to provide a number when ANALYZE is
> specified, but it will be also better to specify what was estimated. We do that for (cost snd rows etc.)
> but doing that somewhere in the plan output may not have a precedent. I think we should try that
> and see what others think.

It's interesting! It’s an idea that can be applied not only to multi-column indexes, right?
I will consider the implementation and discuss it in a new thread. However, I would like to
focus on the feature to output information about multi-column indexes at first.

Regards,
--
Masahiro Ikeda
NTT DATA CORPORATION

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-06-26 07:34:31 Re: Backporting BackgroundPsql
Previous Message Masahiro.Ikeda 2024-06-26 06:51:39 RE: Improve EXPLAIN output for multicolumn B-Tree Index