mirror of
https://github.com/postgres/postgres.git
synced 2025-10-24 01:29:19 +03:00
Fix BRIN cost estimation
The original code was overly optimistic about the cost of scanning a BRIN index, leading to BRIN indexes being selected when they'd be a worse choice than some other index. This complete rewrite should be more accurate. Author: David Rowley, based on an earlier patch by Emre Hasegeli Reviewed-by: Emre Hasegeli Discussion: https://postgr.es/m/CAKJS1f9n-Wapop5Xz1dtGdpdqmzeGqQK4sV2MK-zZugfC14Xtw@mail.gmail.com
This commit is contained in:
@@ -25,6 +25,17 @@ typedef struct BrinOptions
|
||||
bool autosummarize;
|
||||
} BrinOptions;
|
||||
|
||||
|
||||
/*
|
||||
* BrinStatsData represents stats data for planner use
|
||||
*/
|
||||
typedef struct BrinStatsData
|
||||
{
|
||||
BlockNumber pagesPerRange;
|
||||
BlockNumber revmapNumPages;
|
||||
} BrinStatsData;
|
||||
|
||||
|
||||
#define BRIN_DEFAULT_PAGES_PER_RANGE 128
|
||||
#define BrinGetPagesPerRange(relation) \
|
||||
((relation)->rd_options ? \
|
||||
@@ -35,4 +46,7 @@ typedef struct BrinOptions
|
||||
((BrinOptions *) (relation)->rd_options)->autosummarize : \
|
||||
false)
|
||||
|
||||
|
||||
extern void brinGetStats(Relation index, BrinStatsData *stats);
|
||||
|
||||
#endif /* BRIN_H */
|
||||
|
||||
Reference in New Issue
Block a user