2016-04-01 16:42:24 +03:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* blcost.c
|
|
|
|
* Cost estimate function for bloom indexes.
|
|
|
|
*
|
2023-01-02 23:00:37 +03:00
|
|
|
* Copyright (c) 2016-2023, PostgreSQL Global Development Group
|
2016-04-01 16:42:24 +03:00
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
|
|
|
* contrib/bloom/blcost.c
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#include "postgres.h"
|
|
|
|
|
2019-10-23 06:56:22 +03:00
|
|
|
#include "bloom.h"
|
2016-04-01 16:42:24 +03:00
|
|
|
#include "fmgr.h"
|
|
|
|
#include "utils/selfuncs.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Estimate cost of bloom index scan.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
blcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
|
|
|
|
Cost *indexStartupCost, Cost *indexTotalCost,
|
2017-02-15 21:53:24 +03:00
|
|
|
Selectivity *indexSelectivity, double *indexCorrelation,
|
|
|
|
double *indexPages)
|
2016-04-01 16:42:24 +03:00
|
|
|
{
|
|
|
|
IndexOptInfo *index = path->indexinfo;
|
2022-07-16 09:42:15 +03:00
|
|
|
GenericCosts costs = {0};
|
2016-04-01 16:42:24 +03:00
|
|
|
|
|
|
|
/* We have to visit all index tuples anyway */
|
|
|
|
costs.numIndexTuples = index->tuples;
|
|
|
|
|
|
|
|
/* Use generic estimate */
|
2019-02-15 21:05:19 +03:00
|
|
|
genericcostestimate(root, path, loop_count, &costs);
|
2016-04-01 16:42:24 +03:00
|
|
|
|
|
|
|
*indexStartupCost = costs.indexStartupCost;
|
|
|
|
*indexTotalCost = costs.indexTotalCost;
|
|
|
|
*indexSelectivity = costs.indexSelectivity;
|
|
|
|
*indexCorrelation = costs.indexCorrelation;
|
2017-02-15 21:53:24 +03:00
|
|
|
*indexPages = costs.numIndexPages;
|
2016-04-01 16:42:24 +03:00
|
|
|
}
|