Re: Bad selectivity estimate when using a sub query to determine WHERE condition

2020-02-10 Thread Justin Pryzby
On Mon, Feb 10, 2020 at 11:34:01AM +0100, Chris Borckholder wrote: > I have a large table of immutable events that need to be aggregated > regularly to derive statistics. To improve the performance, that table is > rolled up every 15minutes, so that online checks can aggregate rolled up > data and

Re: Bad selectivity estimate when using a sub query to determine WHERE condition

2020-02-10 Thread Tom Lane
Chris Borckholder writes: > When using a sub select or CTE to get the latest roll up time, the query > planner fails to recognize that a most of the large table would be filtered > out by the condition and tries a sequential scan instead of an index scan. > When using the literal value for the

Re: Fwd: TOAST table performance problem

2020-02-10 Thread Asya Nevra Buyuksoy
Ok, you are right. Thanks for everything. Jeff Janes , 10 Şub 2020 Pzt, 15:54 tarihinde şunu yazdı: > On Mon, Feb 10, 2020 at 7:38 AM Asya Nevra Buyuksoy > wrote: > >> Got it, thanks! I understand and know it that PostgreSQL is not slow, but >> I want to a piece of advice how can I load this

Re: Fwd: TOAST table performance problem

2020-02-10 Thread Asya Nevra Buyuksoy
Got it, thanks! I understand and know it that PostgreSQL is not slow, but I want to a piece of advice how can I load this data fastly :) Luís Roberto Weck , 10 Şub 2020 Pzt, 15:31 tarihinde şunu yazdı: > -- Forwarded message - > Gönderen: Asya Nevra Buyuksoy > Date: 10 Şub 2020

Re: Fwd: TOAST table performance problem

2020-02-10 Thread Luís Roberto Weck
-- Forwarded message - Gönderen: *Asya Nevra Buyuksoy* > Date: 10 Şub 2020 Pzt, 10:51 Subject: Re: TOAST table performance problem To: Andreas Joseph Krogh mailto:andr...@visena.com>> I copied my data to the CSV file, yes it is very fast. However,

Bad selectivity estimate when using a sub query to determine WHERE condition

2020-02-10 Thread Chris Borckholder
Hi, I have a large table of immutable events that need to be aggregated regularly to derive statistics. To improve the performance, that table is rolled up every 15minutes, so that online checks can aggregate rolled up data and combine it with latest events created after the last roll up. To