Re: CTE Inline On TPC-DS Query 95

2024-11-25 Thread David Rowley
On Tue, 26 Nov 2024 at 10:03, Ba Jinsheng wrote: > If we specify ``NOT MATERIALIZED`` for the query, the execution time is > reduced from 1min to 1s due to the usage of inline CTE. It seems expected as > described in the PostgreSQL documentation. However, from the code: > https://github.com/pos

Re: Performance of TPC-DS Query 95

2024-11-25 Thread David Rowley
On Tue, 26 Nov 2024 at 09:55, Ba Jinsheng wrote: > TPC-DS query 95: > Its execution time is nearly 1 min: >CTE ws_wh > -> Hash Join (cost=37772.14..198810.77 rows=7242361 width=12) (actual > time=211.161..1443.926 rows=6644004 loops=1) > If applying this patch: > - if (is_inne

Performance of TPC-DS Query 95

2024-11-25 Thread Ba Jinsheng
Hi all, Please see this case. TPC-DS query 95: with ws_wh as (select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2 from web_sales ws1,web_sales ws2 where ws1.ws_order_number = ws2.ws_order_number and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) select count(distinct

CTE Inline On TPC-DS Query 95

2024-11-25 Thread Ba Jinsheng
Hi all, Still for the query 95: with ws_wh as (select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2 from web_sales ws1,web_sales ws2 where ws1.ws_order_number = ws2.ws_order_number and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) select count(distinct ws_order_number

Re: Cardinality estimate of the inner relation

2024-11-25 Thread Frédéric Yhuel
On 11/23/24 03:07, Andrei Lepikhov wrote: Thanks for the case provided! Thanks for your answer! I wonder if data science has invented a statistic or selectivity estimation technique that could tackle your case in general. As I see, we should touch the table of products to realise which s