summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlvaro Herrera2017-04-06 20:49:26 +0000
committerAlvaro Herrera2017-04-06 20:51:53 +0000
commit7e534adcdc70866e7be74d626b0ed067c890a251 (patch)
tree609e0b65eb10538fdaa787fc29dee9655a6da710 /src/include
parentb2ff37d43cc81348fd8e9d9c5fcc9dfadf790763 (diff)
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
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/brin.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/access/brin.h b/src/include/access/brin.h
index 3f4c29bdcb5..e03aa08f608 100644
--- a/src/include/access/brin.h
+++ b/src/include/access/brin.h
@@ -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 */