Re: Plan not skipping unnecessary inner join

2020-05-13 Thread David Wheeler
> Am I missing a situation where these joins could impact the result? Yes it will impact the number of rows in the result. for example if foo is empty then postgres is required to return no results, regardless of how many rows are in bar. This is why it can ignore the table in the left join — D

Re: Slow planning, fast execution for particular 3-table query

2019-11-06 Thread David Wheeler
Is default_statistics_target set above default 100? I would assume that would reflect in the size of pg_statistic, but wanted to ask since increasing that from 100 to 1000 was the only time I have seen planning time explode. Are other queries slow to plan? Looks like you’ve found it! Someone ha

Re: Slow planning, fast execution for particular 3-table query

2019-11-06 Thread David Wheeler
a non-prod environment so we can muck about a bit more. If we can reproduce it in a safe place, is there a tool we can use to get more info out of the query planner to find what it’s doing to take so long? Regards, David From: Pavel Stehule Date: Monday, 4 November 2019 at 4:53 pm To: Da

Re: Slow planning, fast execution for particular 3-table query

2019-11-03 Thread David Wheeler
I'll try reindexing each of the tables just to make sure it's not strange index imbalance or something causing the issue. Regards, David On 4/11/19, 4:01 pm, "Tom Lane" wrote: David Wheeler writes: > We’re having trouble working out why the planning time

Re: Slow planning, fast execution for particular 3-table query

2019-11-03 Thread David Wheeler
I'm not sure what "unusually large" is, but they're all < 1mb which is a little larger than some of our other comparable databases (mostly <300kb) but seems reasonable to me. Regards, David On 4/11/19, 3:37 pm, "Laurenz Albe" wrote: On Mon, 2019

Slow planning, fast execution for particular 3-table query

2019-11-03 Thread David Wheeler
ction that may be holding up autovac, no sign of bloated indexes. TIA! Best regards, David Wheeler General Manager Bali Office Bali T +62 361 475 2333 M +62 819 3660 9180 E dwhee...@dgitsystems.com<mailto:dwhee...@dgitsystems.com> Jl. Pura Mertasari No. 7, Sunset Road Abian

Re: Queue table that quickly grows causes query planner to choose poor plan

2018-06-27 Thread David Wheeler
ints out I can selectively ANALYSE only when > x rows are inserted, which I think is the best way forward. David Wheeler Software developer [cid:2C4D0888-9F8B-463F-BD54-2B60A322210C] E dwhee...@dgitsystems.com<mailto:dwhee...@dgitsystems.com> D +61 3 9663 3554 W http://dgitsystems.com Le

Queue table that quickly grows causes query planner to choose poor plan

2018-06-27 Thread David Wheeler
se where for example 0 rows are inserted in step 2 and this is expected to run very very quickly. Do I have any other options? Postgres 9.5 ATM, but an upgrade is in planning. Thanks in advance David Wheeler Software developer [cid:2C4D0888-9F8B-463F-BD54-2B60A322210C] E dwhee...@dgitsystems.com&