Re: explain analyze rows=%.0f

From: Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
Subject: Re: explain analyze rows=%.0f
Date: 2025-03-06 21:18:52
Message-ID: 432c75b0-be5f-4836-b46b-98c505eaad28@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06.03.2025 17:13, Robert Haas wrote:
> On Thu, Mar 6, 2025 at 8:30 AM Matthias van de Meent
> <boekewurm+postgres(at)gmail(dot)com> wrote:
>> On Thu, 6 Mar 2025 at 14:18, Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru> wrote:
>>> Hi! I got a query plan with a strange number of rows. Could you please
>>> help me understand it?
>>>
>>> To be honest I can't understand why 0.50 number of rows here?
>> Because the scan matched only ~(500 rows over 999 iterations = 500/999
>> ~=) 0.50 rows for every loop, on average, for these plan nodes:
> This is a good and correct explanation, but I'm VERY curious to hear
> more from Alena. Like, Tom expressed the concern before we did this
> that the fractional digits would confuse people, and the fact that
> someone who is a regular participant on this mailing list was one of
> the people confused gives credence to that concern. But I want to know
> what exactly Alena found (or finds) confusing here. The Nested Loop
> executes 999 times, so perhaps Alena thought that 0.50 was the TOTAL
> number of rows across ALL of those executions rather than the AVERAGE
> number of rows per execution? Because then 0.50 would indeed be a very
> surprising result. Or maybe she just didn't realize that part of the
> plan executed 999 times? Or something else?
>
> Alena, if you're willing, please elaborate on what you think is confusing here!

To be honest, I initially took it as the total number of tuples and
couldn't figure out for myself how to interpret the result - 0 tuples or
1 tuple in the end. Maybe it wasn't quite correct to perceive it that
way, but Matthias's explanation helped me figure out the reason why such
a strange result was obtained, although it's not usual to see it.

--
Regards,
Alena Rybakina
Postgres Professional

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-03-06 21:19:22 Re: what's going on with lapwing?
Previous Message Robert Haas 2025-03-06 21:17:22 Re: what's going on with lapwing?