Re: bitmaps and correlation - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: bitmaps and correlation
Date
Msg-id CAFiTN-vNc0z1GfPDCow_+tsk-7LykXHg=tseuR7dTgPQSQB8wQ@mail.gmail.com
Whole thread Raw
In response to Re: bitmaps and correlation  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: bitmaps and correlation  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-hackers
On Tue, Jan 7, 2020 at 1:29 AM Justin Pryzby <pryzby@telsasoft.com> wrote:
>
> Find attached cleaned up patch.
> For now, I updated the regress/expected/, but I think the test maybe has to be
> updated to do what it was written to do.

I have noticed that in "cost_index" we have used the indexCorrelation
for computing the run_cost, not the number of pages whereas in your
patch you have used it for computing the number of pages.  Any reason
for the same?

cost_index
{
..
/*
* Now interpolate based on estimated index order correlation to get total
* disk I/O cost for main table accesses.
*/
csquared = indexCorrelation * indexCorrelation;
run_cost += max_IO_cost + csquared * (min_IO_cost - max_IO_cost);
}

Patch
- pages_fetched = (2.0 * T * tuples_fetched) / (2.0 * T + tuples_fetched);
+ pages_fetchedMAX = (2.0 * T * tuples_fetched) / (2.0 * T + tuples_fetched);
+
+ /* pages_fetchedMIN is for the perfectly correlated case (csquared=1) */
+ pages_fetchedMIN = ceil(indexSelectivity * (double) baserel->pages);
+
+ pages_fetched = pages_fetchedMAX +
indexCorrelation*indexCorrelation*(pages_fetchedMIN -
pages_fetchedMAX);

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Recognizing superuser in pg_hba.conf
Next
From: Amit Langote
Date:
Subject: Re: adding partitioned tables to publications