From: | Jim Nasby <jim(dot)nasby(at)openscg(dot)com> |
---|---|
To: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Split conditions on relations |
Date: | 2017-03-16 04:43:04 |
Message-ID: | 1add3cd0-75a9-61d9-2856-cc529bad0e16@openscg.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I've got a customer that is running a pretty expensive function as part
of a WHERE clause. With or without the function, the table the function
references is the inner-most of a series of nested loops. Without the
function things are very fast, but adding the function increases the
cost of the index scan on that table by a factor of ~80x. It also
falsely skews the row estimate further down, causing a bad shift to
materialization in another part of the query, but that's a different
problem. Wrapping the majority of the query in an OFFSET 0 with the
function call on the outside makes things fast again.
It'd be nice if function execution could be delayed to a higher level of
a query based on the cost.
--
Jim Nasby, Chief Data Architect, OpenSCG
http://OpenSCG.com
From | Date | Subject | |
---|---|---|---|
Next Message | vinayak | 2017-03-16 05:15:52 | Re: pg_stat_wal_write statistics view |
Previous Message | Alvaro Herrera | 2017-03-16 04:36:51 | Re: multivariate statistics (v25) |