Restructure index access method API to hide most of it at the C level.
This patch reduces pg_am to just two columns, a name and a handler
function. All the data formerly obtained from pg_am is now provided
in a C struct returned by the handler function. This is similar to
the designs we've adopted for FDWs and tablesample methods. There
are multiple advantages. For one, the index AM's support functions
are now simple C functions, making them faster to call and much less
error-prone, since the C compiler can now check function signatures.
For another, this will make it far more practical to define index access
methods in installable extensions.
A disadvantage is that SQL-level code can no longer see attributes
of index AMs; in particular, some of the crosschecks in the opr_sanity
regression test are no longer possible from SQL. We've addressed that
by adding a facility for the index AM to perform such checks instead.
(Much more could be done in that line, but for now we're content if the
amvalidate functions more or less replace what opr_sanity used to do.)
We might also want to expose some sort of reporting functionality, but
this patch doesn't do that.
Alexander Korotkov, reviewed by Petr Jelínek, and rather heavily
editorialized on by me.
2016-01-18 01:36:59 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* index_selfuncs.h
|
|
|
|
* Index cost estimation functions for standard index access methods.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Note: this is split out of selfuncs.h mainly to avoid importing all of the
|
|
|
|
* planner's data structures into the non-planner parts of the index AMs.
|
|
|
|
* If you make it depend on anything besides access/amapi.h, that's likely
|
|
|
|
* a mistake.
|
|
|
|
*
|
2017-01-03 19:48:53 +01:00
|
|
|
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
|
Restructure index access method API to hide most of it at the C level.
This patch reduces pg_am to just two columns, a name and a handler
function. All the data formerly obtained from pg_am is now provided
in a C struct returned by the handler function. This is similar to
the designs we've adopted for FDWs and tablesample methods. There
are multiple advantages. For one, the index AM's support functions
are now simple C functions, making them faster to call and much less
error-prone, since the C compiler can now check function signatures.
For another, this will make it far more practical to define index access
methods in installable extensions.
A disadvantage is that SQL-level code can no longer see attributes
of index AMs; in particular, some of the crosschecks in the opr_sanity
regression test are no longer possible from SQL. We've addressed that
by adding a facility for the index AM to perform such checks instead.
(Much more could be done in that line, but for now we're content if the
amvalidate functions more or less replace what opr_sanity used to do.)
We might also want to expose some sort of reporting functionality, but
this patch doesn't do that.
Alexander Korotkov, reviewed by Petr Jelínek, and rather heavily
editorialized on by me.
2016-01-18 01:36:59 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
* src/include/utils/index_selfuncs.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef INDEX_SELFUNCS_H
|
|
|
|
#define INDEX_SELFUNCS_H
|
|
|
|
|
|
|
|
#include "access/amapi.h"
|
|
|
|
|
|
|
|
/* Functions in selfuncs.c */
|
|
|
|
extern void brincostestimate(struct PlannerInfo *root,
|
|
|
|
struct IndexPath *path,
|
|
|
|
double loop_count,
|
|
|
|
Cost *indexStartupCost,
|
|
|
|
Cost *indexTotalCost,
|
|
|
|
Selectivity *indexSelectivity,
|
|
|
|
double *indexCorrelation);
|
|
|
|
extern void btcostestimate(struct PlannerInfo *root,
|
|
|
|
struct IndexPath *path,
|
|
|
|
double loop_count,
|
|
|
|
Cost *indexStartupCost,
|
|
|
|
Cost *indexTotalCost,
|
|
|
|
Selectivity *indexSelectivity,
|
|
|
|
double *indexCorrelation);
|
|
|
|
extern void hashcostestimate(struct PlannerInfo *root,
|
|
|
|
struct IndexPath *path,
|
|
|
|
double loop_count,
|
|
|
|
Cost *indexStartupCost,
|
|
|
|
Cost *indexTotalCost,
|
|
|
|
Selectivity *indexSelectivity,
|
|
|
|
double *indexCorrelation);
|
|
|
|
extern void gistcostestimate(struct PlannerInfo *root,
|
|
|
|
struct IndexPath *path,
|
|
|
|
double loop_count,
|
|
|
|
Cost *indexStartupCost,
|
|
|
|
Cost *indexTotalCost,
|
|
|
|
Selectivity *indexSelectivity,
|
|
|
|
double *indexCorrelation);
|
|
|
|
extern void spgcostestimate(struct PlannerInfo *root,
|
|
|
|
struct IndexPath *path,
|
|
|
|
double loop_count,
|
|
|
|
Cost *indexStartupCost,
|
|
|
|
Cost *indexTotalCost,
|
|
|
|
Selectivity *indexSelectivity,
|
|
|
|
double *indexCorrelation);
|
|
|
|
extern void gincostestimate(struct PlannerInfo *root,
|
|
|
|
struct IndexPath *path,
|
|
|
|
double loop_count,
|
|
|
|
Cost *indexStartupCost,
|
|
|
|
Cost *indexTotalCost,
|
|
|
|
Selectivity *indexSelectivity,
|
|
|
|
double *indexCorrelation);
|
|
|
|
|
|
|
|
#endif /* INDEX_SELFUNCS_H */
|