Re: More records after sort

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nicolas Seinlet <nicolas(at)seinlet(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: More records after sort
Date: 2021-07-20 17:07:43
Message-ID: 485659.1626800863@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Nicolas Seinlet <nicolas(at)seinlet(dot)com> writes:
> Many thanks for the fast response. The full query plan is below, and the Dalibo link points to it as well. You're right, it's a merge join. One table doesn't have up-to-date statistics, because the table is filled during the transaction involving this query.

Sure looks like incorporating an ANALYZE into the transaction would help
matters. This misestimation:

> -> Seq Scan on account_invoice_line il (cost=0.00..9885.48 rows=752 width=22) (actual time=0.049..121.238 rows=150448 loops=1)
> Filter: (display_type IS NULL)

looks like it's really hurting you, and "ANALYZE account_invoice_line"
after loading that table ought to be enough to fix that.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Zhihong Yu 2021-07-20 21:33:07 Re: Have I found an interval arithmetic bug?
Previous Message Nicolas Seinlet 2021-07-20 15:07:27 Re: More records after sort