pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nicolas Seinlet <nicolas@seinlet.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: More records after sort
Date: Tue, 20 Jul 2021 13:07:43 -0400
Message-ID: <485659.1626800863@sss.pgh.pa.us> (raw)
In-Reply-To: <XIvi0CUmhXFqNzBx3QlNJcwzA9_twozgYMgvvU77b_9eFO0e6_X0LbONKuLPFsGSWGWDRG931KAVa3_RGo41LtFD9WZWlLqpX53N-5mS4oQ=@seinlet.com>
References: <sccAkd2JVf0NntlWtYcU8-h-xCZxuwuCqF1vpTrIG1VR1DffM3t4QlMiMRrLR4VyJm5oyUa1n-TmPhnkCA6fLoT0tfAWGD2c7NlrihonP9Q=@seinlet.com>
	<368621.1626791677@sss.pgh.pa.us>
	<XIvi0CUmhXFqNzBx3QlNJcwzA9_twozgYMgvvU77b_9eFO0e6_X0LbONKuLPFsGSWGWDRG931KAVa3_RGo41LtFD9WZWlLqpX53N-5mS4oQ=@seinlet.com>

Nicolas Seinlet <nicolas@seinlet.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





view thread (6+ messages)  latest in thread

Message-ID: <485659.1626800863@sss.pgh.pa.us>
Permalink:  ../485659.1626800863@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/485659.1626800863@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nicolas@seinlet.com
  Subject: Re: More records after sort
  In-Reply-To: <485659.1626800863@sss.pgh.pa.us>
  References: <sccAkd2JVf0NntlWtYcU8-h-xCZxuwuCqF1vpTrIG1VR1DffM3t4QlMiMRrLR4VyJm5oyUa1n-TmPhnkCA6fLoT0tfAWGD2c7NlrihonP9Q=@seinlet.com> <368621.1626791677@sss.pgh.pa.us> <XIvi0CUmhXFqNzBx3QlNJcwzA9_twozgYMgvvU77b_9eFO0e6_X0LbONKuLPFsGSWGWDRG931KAVa3_RGo41LtFD9WZWlLqpX53N-5mS4oQ=@seinlet.com> <485659.1626800863@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox