From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: subselect requires offset 0 for good performance. |
Date: | 2013-08-02 19:31:18 |
Message-ID: | 6895.1375471878@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> writes:
> I extracted all the data like so:
> select * into dba.pp_test_wide from original table;
> and get this query plan from explain analyze:
> http://explain.depesz.com/s/EPx which takes 20 minutes to run.
> If I extract it this way:
> select tree_sortkey, product_name, deleted_at into db.pp_test_3col
> from original table;
> I get this plan: http://explain.depesz.com/s/gru which gets a
> materialize in it, and suddenly takes 106 ms.
There's no reason why suppressing some unrelated columns would change the
rowcount estimates, but those two plans show different rowcount estimates.
I suspect the *actual* reason for the plan change was that autovacuum had
had a chance to update statistics for the one table, and not yet for the
other. Please do a manual ANALYZE on both tables and see if there's
still a plan difference.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-08-02 19:43:25 | Re: Looks like merge join planning time is too big, 55 seconds |
Previous Message | Sergey Burladyan | 2013-08-02 17:11:24 | Re: Looks like merge join planning time is too big, 55 seconds |