public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrei Lepikhov <[email protected]>
To: Ba Jinsheng <[email protected]>
To: [email protected] <[email protected]>
Subject: Re: Performance of Query 4 on TPC-DS Benchmark
Date: Mon, 11 Nov 2024 16:41:01 +0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <SEZPR06MB6494F6A2837995BDD4E0BF9A8A5F2@SEZPR06MB6494.apcprd06.prod.outlook.com>
References: <SEZPR06MB6494F6A2837995BDD4E0BF9A8A5F2@SEZPR06MB6494.apcprd06.prod.outlook.com>

On 11/11/24 02:35, Ba Jinsheng wrote:
> Hi all,
> 
> Please see this case:
> 
> 
> Query 4 on TPC-DS benchmark:
Thank you for interesting example!
Looking into explains I see two sortings:
->  Sort  (cost=794037.94..794037.95 rows=1 width=132)
    (actual time=3024403.310..3024403.313 rows=8 loops=1)
->  Sort  (cost=794033.93..794033.94 rows=1 width=132)
    (actual time=8068.869..8068.872 rows=8 loops=1)

Almost the same cost and different execution time. So, I think, the core 
of the problem in accuracy of selectivity estimation.
In this specific example I see lots of composite scan filters:
- ((sale_type = 'w'::text) AND (dyear = 2002))
- ((year_total > '0'::numeric) AND (sale_type = 'w'::text) AND (dyear = 
2001))
- ((year_total > '0'::numeric) AND (sale_type = 's'::text) AND (dyear = 
2001))

It is all the time a challenge for PostgreSQL to estimate such a filter 
because of absent information on joint column distribution.
Can you research this way by building extended statistics on these 
clauses? It could move the plan to the more optimal direction.

-- 
regards, Andrei Lepikhov





view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Performance of Query 4 on TPC-DS Benchmark
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox