RE: extended statistics n-distinct on multiple columns not used when join two tables

From: "James Pang (chaolpan)" <chaolpan(at)cisco(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: extended statistics n-distinct on multiple columns not used when join two tables
Date: 2023-06-13 11:32:54
Message-ID: PH0PR11MB519198036EB5D09B3D19BE52D655A@PH0PR11MB5191.namprd11.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Thanks for your information, yes, with multiple columns equal join and correlation , looks like extended statistics could help reduce “significantly rows estimation”. Hopefully it’s in future version.

James

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Sent: Tuesday, June 13, 2023 7:29 PM
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>; James Pang (chaolpan) <chaolpan(at)cisco(dot)com>
Subject: Re: extended statistics n-distinct on multiple columns not used when join two tables

út 13. 6. 2023 v 13:26 odesílatel David Rowley <dgrowleyml(at)gmail(dot)com<mailto:dgrowleyml(at)gmail(dot)com>> napsal:
(moving to -hackers)

On Tue, 13 Jun 2023 at 21:30, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com<mailto:pavel(dot)stehule(at)gmail(dot)com>> wrote:
> út 13. 6. 2023 v 11:21 odesílatel James Pang (chaolpan) <chaolpan(at)cisco(dot)com<mailto:chaolpan(at)cisco(dot)com>> napsal:
>> When join two table on multiple columns equaljoin, rows estimation always use selectivity = multiplied by distinct multiple individual columns, possible to use extended n-distinct statistics on multiple columns?
>>
>> PG v14.8-1, attached please check test case with details.
>
> There is not any support for multi tables statistic

I think it's probably worth adjusting the docs to mention this. It
seems like it might be something that could surprise someone.

Something like the attached, maybe?

+1

Pavel

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2023-06-13 11:58:02 Re: [PATCH] Slight improvement of worker_spi.c example
Previous Message Pavel Stehule 2023-06-13 11:28:34 Re: extended statistics n-distinct on multiple columns not used when join two tables

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2023-06-13 13:50:48 Re: Postgresql equal join on function with columns not use index
Previous Message Pavel Stehule 2023-06-13 11:28:34 Re: extended statistics n-distinct on multiple columns not used when join two tables