Re: rows estimate in explain analyze for the BRIN index - Mailing list pgsql-hackers

From Tom Lane
Subject Re: rows estimate in explain analyze for the BRIN index
Date
Msg-id 23886.1451506336@sss.pgh.pa.us
Whole thread Raw
In response to Re: rows estimate in explain analyze for the BRIN index  (Emre Hasegeli <emre@hasegeli.com>)
Responses Re: rows estimate in explain analyze for the BRIN index  (Oleksii Kliukin <alexk@hintbits.com>)
Re: rows estimate in explain analyze for the BRIN index  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Emre Hasegeli <emre@hasegeli.com> writes:
>> I don’t see how to solve this problem without changing explain analyze output to accommodate for “unknown” value. I
don’tthink “0” is a non-confusing representation of “unknown” for most people, and from the practical standpoint, a
“besteffort” estimate is better than 0 (i.e. I will be able to estimate how efficient BRIN index is for my tables in
termsof the number of tuples retrieved/thrown away)
 

We do already have a nearby precedent for returning zero when we don't
have an accurate answer: that's what BitmapAnd and BitmapOr plan nodes
do.  (This is documented btw, at the bottom of section 14.1.)

> The number of retrieved and thrown away rows are already available on
> the upper part of the plan.  Bitmap Index Scan should provide the rows
> that matched the index.

It doesn't have that information.

> Another alternative would be just returning
> the number of matching pages (by not multiplying with 10).  It might
> be better understood.

No, it would not, at least not unless we found a way to explicitly mark
the output as being blocks not rows (which would doubtless break a lot of
existing client-side code).  Zero is fairly clearly an impossible value,
whereas anything that's not zero is going to be taken at face value by
many users.

On balance I think likely the best thing to do is return zero, and
document that behavior.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Emre Hasegeli
Date:
Subject: Re: rows estimate in explain analyze for the BRIN index
Next
From: Alvaro Herrera
Date:
Subject: Re: On columnar storage (2)