public inbox for [email protected]  
help / color / mirror / Atom feed
From: Robert Haas <[email protected]>
To: Ilia Evdokimov <[email protected]>
Cc: Matthias van de Meent <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Andrei Lepikhov <[email protected]>
Cc: [email protected]
Cc: Guillaume Lelarge <[email protected]>
Cc: Matheus Alcantara <[email protected]>
Cc: Alena Rybakina <[email protected]>
Subject: Re: explain analyze rows=%.0f
Date: Mon, 31 Mar 2025 13:35:49 -0400
Message-ID: <CA+TgmoZz-t4swNuD--8brJi69b4ZAJ6riamd6hVJmvNL0L5=wA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CA+TgmoZv8DvmeQHQAX+rkn68id2N+DoUhFZB36d-_w1tyAeqeA@mail.gmail.com>
	<CA+Tgmoaob_3aNF5S49WFoJs6Rb37rNnd5WH_e9nXAn_jtWWCLQ@mail.gmail.com>
	<[email protected]>
	<CA+TgmobXwtS0ncAVfukE-Uhhy8Zt5rQWwQb2WHBcSop8r4Lcgw@mail.gmail.com>
	<[email protected]>
	<CA+TgmoZp7LstKmDwyfUuB+6aFFhn0N3fv2QxTD=dkrxXVJ5dZA@mail.gmail.com>
	<CA+TgmoazzVHn8sFOMFAEwoqBTDxKT45D7mvkyeHgqtoD2cn58Q@mail.gmail.com>
	<[email protected]>
	<CA+TgmoZxRP8cEhfdF27k600B_=8DXpj=8kiM7s_6qCHCqxQPmA@mail.gmail.com>
	<CA+TgmoapgkOFmezwVjJbs5Xq9F+Mfm9aNouBgTq_AuqQJkLYEg@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAEze2Wiap5v-H-5QqGq-=DBG99CK-RgHpQUFaU6TENh_+zCh_w@mail.gmail.com>
	<CA+TgmobD4_fz4JnGkYey_2rsXi5mxucDPR2ot6rX9OoHBw+qhg@mail.gmail.com>
	<[email protected]>
	<CA+Tgmob2FcdNQnfv20hFHMiQjqsmak4NnkmxjNQnNpzzbowmgQ@mail.gmail.com>
	<[email protected]>

On Tue, Mar 11, 2025 at 5:58 AM Ilia Evdokimov
<[email protected]> wrote:
> In the stats_ext regression test, there is a function
> check_estimated_rows that returns actual rows as an integer. Currently,
> none of the test cases produce a non-zero fractional part in actual rows.
>
> The question is: should this function be modified to return a fractional
> number instead of an integer?
>
> Personally, I don’t see much value in doing so, because the purpose of
> the test is to compare the estimated row count with the actual number of
> rows. It is also unlikely that there will be test cases where loops > 1,
> and the presence of a fractional part does not change the essence of the
> test.
>
> What do you think?

I suppose the way this is currently coded, it will have the effect of
extracting the integer part of the row estimate. That doesn't really
seem like a bad idea to me, so I'm not sure it's worth trying to
adjust anything here.

One thing that I just noticed, though, is that we added two decimal
places to the actual row count, but not the estimated row count. So
now we get stuff like this:

         ->  Seq Scan on pgbench_branches b  (cost=0.00..1.10 rows=10
width=364) (actual time=0.007..0.009 rows=10.00 loops=1)

But why isn't it just as valuable to have two decimal places for the
estimate? I theorize that the cases that are really a problem here are
those where the row count estimate is between 0 and 1 per row, and
rounding to an integer loses all precision.

-- 
Robert Haas
EDB: http://www.enterprisedb.com





view thread (77+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: explain analyze rows=%.0f
  In-Reply-To: <CA+TgmoZz-t4swNuD--8brJi69b4ZAJ6riamd6hVJmvNL0L5=wA@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox