[GENERAL] workaround for column cross-correlation - Mailing list pgsql-general

From Justin Pryzby
Subject [GENERAL] workaround for column cross-correlation
Date
Msg-id 20170613031752.GB4653@telsasoft.com
Whole thread Raw
Responses Re: [GENERAL] workaround for column cross-correlation
List pgsql-general
I know PG 10 will have support "CREATE STATISTICS.." for this..

..but I wondered if there's a recommended workaround in earlier versions ?

We had two issues:

1) improper estimate caused poor plans (nested loops due to ::date, GROUP BY,
cross-column stats, and maybe more).
2) memory explosion in hash join (due to poor estimate?) caused OOM.

I tried ROW/ARRAY comparison for the correlated columns which seems to do what
I want, acting as a single comparison, rather than two, independent
comparisons.

->  Merge Join  (cost=57811.81..62290.04 rows=114606 width=58) (actual time=5174.556..5698.323 rows=204672 loops=1)
   Merge Cond: ((eric_enodeb_cellrelation_metrics.start_time = eric_enodeb_cellrelation_metrics_1.start_time) AND
((ROW(eric_enodeb_cellrelation_metrics.sect_id,eric_enodeb_cellrelation_metrics.neigh_sect_id)) =
(ROW(eric_enodeb_cellrelation_metrics_1.neigh_sect_id,eric_enodeb_cellrelation_metrics_1.sect_id)))) 

Thanks,
Justin


pgsql-general by date:

Previous
From: armand pirvu
Date:
Subject: Re: [GENERAL] Strange port in pg_upgrade output
Next
From: Jeff Janes
Date:
Subject: Re: [GENERAL] workaround for column cross-correlation