Skip to content

Commit 9ee014f

Browse files
committed
Bloom index contrib module
Module provides new access method. It is actually a simple Bloom filter implemented as pgsql's index. It could give some benefits on search with large number of columns. Module is a single way to test generic WAL interface committed earlier. Author: Teodor Sigaev, Alexander Korotkov Reviewers: Aleksander Alekseev, Michael Paquier, Jim Nasby
1 parent 4e56e5a commit 9ee014f

File tree

18 files changed

+2126
-0
lines changed

18 files changed

+2126
-0
lines changed

contrib/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ SUBDIRS = \
88
adminpack \
99
auth_delay \
1010
auto_explain \
11+
bloom \
1112
btree_gin \
1213
btree_gist \
1314
chkpass \

contrib/bloom/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated subdirectories
2+
/log/
3+
/results/
4+
/tmp_check/

contrib/bloom/Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# contrib/bloom/Makefile
2+
3+
MODULE_big = bloom
4+
OBJS = blcost.o blinsert.o blscan.o blutils.o blvacuum.o blvalidate.o $(WIN32RES)
5+
6+
EXTENSION = bloom
7+
DATA = bloom--1.0.sql
8+
PGFILEDESC = "bloom access method - signature file based index"
9+
10+
REGRESS = bloom
11+
12+
ifdef USE_PGXS
13+
PG_CONFIG = pg_config
14+
PGXS := $(shell $(PG_CONFIG) --pgxs)
15+
include $(PGXS)
16+
else
17+
subdir = contrib/bloom
18+
top_builddir = ../..
19+
include $(top_builddir)/src/Makefile.global
20+
include $(top_srcdir)/contrib/contrib-global.mk
21+
endif
22+
23+
wal-check: temp-install
24+
$(prove_check)

contrib/bloom/blcost.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* blcost.c
4+
* Cost estimate function for bloom indexes.
5+
*
6+
* Copyright (c) 2016, PostgreSQL Global Development Group
7+
*
8+
* IDENTIFICATION
9+
* contrib/bloom/blcost.c
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#include "postgres.h"
14+
15+
#include "fmgr.h"
16+
#include "optimizer/cost.h"
17+
#include "utils/selfuncs.h"
18+
19+
#include "bloom.h"
20+
21+
/*
22+
* Estimate cost of bloom index scan.
23+
*/
24+
void
25+
blcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
26+
Cost *indexStartupCost, Cost *indexTotalCost,
27+
Selectivity *indexSelectivity, double *indexCorrelation)
28+
{
29+
IndexOptInfo *index = path->indexinfo;
30+
List *qinfos;
31+
GenericCosts costs;
32+
33+
/* Do preliminary analysis of indexquals */
34+
qinfos = deconstruct_indexquals(path);
35+
36+
MemSet(&costs, 0, sizeof(costs));
37+
38+
/* We have to visit all index tuples anyway */
39+
costs.numIndexTuples = index->tuples;
40+
41+
/* Use generic estimate */
42+
genericcostestimate(root, path, loop_count, qinfos, &costs);
43+
44+
*indexStartupCost = costs.indexStartupCost;
45+
*indexTotalCost = costs.indexTotalCost;
46+
*indexSelectivity = costs.indexSelectivity;
47+
*indexCorrelation = costs.indexCorrelation;
48+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy