Re: Planner misestimation for JOIN with VARCHAR - Mailing list pgsql-general

From Sebastian Dressler
Subject Re: Planner misestimation for JOIN with VARCHAR
Date
Msg-id B23BF962-E237-4500-8CB5-4418CCD1BB13@swarm64.com
Whole thread Raw
In response to Re: Planner misestimation for JOIN with VARCHAR  (Michael Lewis <mlewis@entrata.com>)
List pgsql-general

> On 9. Jun 2020, at 21:30, Michael Lewis <mlewis@entrata.com> wrote:
> 
>> On Tue, Jun 9, 2020 at 12:34 PM Sebastian Dressler <sebastian@swarm64.com> wrote:
>> - Add an index on top of the whole PK
>> - Add indexes onto other columns trying to help the JOIN
>> - Add additional statistics on two related columns
>> 
>> Another idea I had was to make use of generated columns and hash the PKs together to an BIGINT and solely use this
forthe JOIN. However, this would not work when not all columns of the PK are used for the JOIN.
 
> 
> Can you expand on the additional statistics you created? Why was it on only two columns? Did you include MCVs type of
extendedstats?
 

Sure, for the MCVs specifically I tried to select which columns belong together to also have value for the end-user
whenrunning a query. Basically in accordance what the docs suggest, i.e. [1] section 14.2.2.3 last paragraph. Given the
natureof the data I however think this can be very difficult to do without requiring further user input. Likewise, as
theothers suggested, it did not help for this particular case.
 

Cheers,
Sebastian

[1]: https://www.postgresql.org/docs/current/planner-stats.html#PLANNER-STATS-EXTENDED

--

Sebastian Dressler, Solution Architect 
+49 30 994 0496 72 | sebastian@swarm64.com 

Swarm64 AS
Parkveien 41 B | 0258 Oslo | Norway
Registered at Brønnøysundregistrene in Norway under Org.-Number 911 662 787
CEO/Geschäftsführer (Daglig Leder): Thomas Richter; Chairman/Vorsitzender (Styrets Leder): Dr. Sverre Munck 

Swarm64 AS Zweigstelle Hive
Ullsteinstr. 120 | 12109 Berlin | Germany
Registered at Amtsgericht Charlottenburg - HRB 154382 B


pgsql-general by date:

Previous
From: PEDRO PABLO SEVERIN HONORATO
Date:
Subject: Re: Help with plpython3u
Next
From: Ishan Joshi
Date:
Subject: RE: Postgres server 12.2 crash with process exited abnormally andpossibly corrupted shared memory