pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Torsten Förtsch <tfoertsch123@gmail.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: query plan
Date: Fri, 17 Nov 2023 21:00:20 +0100
Message-ID: <CAKkG4_kD_H0F81EX8585RQu99pMeUQ5Ra17-AX0o7ToZ2bMaOA@mail.gmail.com> (raw)

Hi,

This is part of a query plan:

 Nested Loop Left Join  (cost=26.32..47078866.36 rows=1344945195 width=626)
   ->  Nested Loop Left Join  (cost=25.74..5312.48 rows=1344945195
width=608)
         ->  Nested Loop Left Join  (cost=6.79..2876.77 rows=102 width=373)
               ->  Nested Loop Left Join  (cost=1.90..1965.51 rows=102
width=361)
               ->  Bitmap Heap Scan on ...  (cost=4.89..8.91 rows=2
width=28)
         ->  Hash Left Join  (cost=18.95..42.61 rows=3 width=243)
               ->  Hash Left Join  (cost=18.94..42.59 rows=3 width=203)
               ->  Hash  (cost=0.00..0.00 rows=1 width=48)
   ->  Memoize  (cost=0.58..4.59 rows=1 width=172)

What I don't understand is this. The left node of the join is expected to
return 102 rows. The right node 3. How can this result in >1e9 rows?

The query involved way further down a partitioned table with 2 partitions,
one pretty big in the 1e9 rows range, the other practically empty. The big
partition had been analyzed before. But the partitioned table and the empty
partition never. After analyzing them all was well.

I am just curious to understand how that number is calculated.

This is PG14.

Thanks.

view thread (4+ messages)  latest in thread

Message-ID: <CAKkG4_kD_H0F81EX8585RQu99pMeUQ5Ra17-AX0o7ToZ2bMaOA@mail.gmail.com>
Permalink:  ../CAKkG4_kD_H0F81EX8585RQu99pMeUQ5Ra17-AX0o7ToZ2bMaOA@mail.gmail.com/
Also on:    postgresql.org/message-id/CAKkG4_kD_H0F81EX8585RQu99pMeUQ5Ra17-AX0o7ToZ2bMaOA@mail.gmail.com

 · 

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: tfoertsch123@gmail.com
  Subject: Re: query plan
  In-Reply-To: <CAKkG4_kD_H0F81EX8585RQu99pMeUQ5Ra17-AX0o7ToZ2bMaOA@mail.gmail.com>
  References: <CAKkG4_kD_H0F81EX8585RQu99pMeUQ5Ra17-AX0o7ToZ2bMaOA@mail.gmail.com>

* 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