Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1db943b

Browse files
committed
commit Oleg and Teodor's RD-tree implementation ... this provides theregression tests for the GiST changes ... this should be integrated intothe regular regression tests similar to Vadim's SPI contrib stuff ...
1 parent0ad7db4 commit1db943b

File tree

10 files changed

+6478
-0
lines changed

10 files changed

+6478
-0
lines changed

‎contrib/intarray/Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
subdir = contrib/intarray
2+
top_builddir = ../..
3+
include$(top_builddir)/src/Makefile.global
4+
5+
# override libdir to install shlib in contrib not main directory
6+
libdir :=$(libdir)/contrib
7+
8+
# shared library parameters
9+
NAME= _int
10+
SO_MAJOR_VERSION= 1
11+
SO_MINOR_VERSION= 0
12+
13+
overrideCPPFLAGS += -I$(srcdir) -DPGSQL71
14+
15+
OBJS= _int.o
16+
17+
all: all-lib$(NAME).sql
18+
19+
# Shared library stuff
20+
include$(top_srcdir)/src/Makefile.shlib
21+
22+
23+
$(NAME).sql:$(NAME).sql.in
24+
sed -e's:MODULE_PATHNAME:$(libdir)/$(shlib):g'<$<>$@
25+
26+
.PHONY: submake
27+
submake:
28+
$(MAKE) -C$(top_builddir)/src/test/regress pg_regress
29+
30+
# against installed postmaster
31+
installcheck: submake
32+
@echo"'make installcheck' is not supported."
33+
34+
installcheck: submake
35+
$(top_builddir)/src/test/regress/pg_regress _int
36+
37+
# in-tree test doesn't work yet (no way to install my shared library)
38+
#check: all submake
39+
#$(top_builddir)/src/test/regress/pg_regress --temp-install\
40+
# --top-builddir=$(top_builddir) _int
41+
check:
42+
@echo"'make check' is not supported."
43+
@echo"Do 'make install', then 'make installcheck' instead."
44+
45+
install: all installdirs install-lib
46+
#$(INSTALL_DATA) $(srcdir)/README.$(NAME) $(docdir)/contrib
47+
$(INSTALL_DATA)$(NAME).sql$(datadir)/contrib
48+
49+
installdirs:
50+
$(mkinstalldirs)$(docdir)/contrib$(datadir)/contrib$(libdir)
51+
52+
uninstall: uninstall-lib
53+
rm -f$(docdir)/contrib/README.$(NAME)$(datadir)/contrib/$(NAME).sql
54+
55+
cleandistcleanmaintainer-clean: clean-lib
56+
rm -f*.so y.tab.c y.tab.h$(OBJS)$(NAME).sql
57+
# things created by various check targets
58+
rm -rf results tmp_check log
59+
rm -f regression.diffs regression.out regress.out run_check.out
60+
ifeq ($(PORTNAME), win)
61+
rm -f regress.def
62+
endif
63+
64+
dependdep:
65+
$(CC) -MM$(CFLAGS)*.c>depend
66+
67+
ifeq (depend,$(wildcard depend))
68+
include depend
69+
endif

‎contrib/intarray/Makefile.703

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile --
4+
#
5+
# Makefile for Enzyme Commission catalogue number type -- ec_code
6+
#
7+
#-------------------------------------------------------------------------
8+
9+
PGDIR = ../..
10+
SRCDIR = $(PGDIR)/src
11+
12+
include $(SRCDIR)/Makefile.global
13+
14+
INCLUDE_OPT =-I ./ \
15+
-I $(SRCDIR)/ \
16+
-I $(SRCDIR)/include \
17+
-I $(SRCDIR)/port/$(PORTNAME)
18+
19+
CFLAGS += $(INCLUDE_OPT) $(CFLAGS_SL)
20+
21+
MODNAME =_int
22+
OBJFILES =$(MODNAME).o
23+
24+
SQLDEFS =$(MODNAME).sql
25+
26+
MODULE =$(MODNAME)$(DLSUFFIX)
27+
28+
MODDIR =$(LIBDIR)/modules
29+
30+
SQLDIR =$(LIBDIR)/sql
31+
32+
all:module sql
33+
34+
module:$(MODULE)
35+
36+
sql:$(SQLDEFS)
37+
38+
$(MODULE):$(OBJFILES)
39+
$(CC) $(CFLAGS) -shared -o $@ $(OBJFILES)
40+
41+
install:$(MODULE) $(SQLDEFS) $(MODDIR) $(SQLDIR)
42+
cp -p $(MODULE) $(MODDIR)/
43+
strip $(MODDIR)/$(MODULE)
44+
cp -p $(SQLDEFS) $(SQLDIR)/
45+
46+
$(MODDIR):
47+
mkdir -p $@
48+
49+
$(SQLDIR):
50+
mkdir -p $@
51+
52+
%.sql: %.sql.in
53+
sed "s|MODULE_PATHNAME|$(MODDIR)/$(MODULE)|" < $< > $@
54+
55+
depend dep:
56+
$(CC) -MM $(INCLUDE_OPT) *.c >depend
57+
58+
clean:
59+
rm -f $(MODULE) $(SQLDEFS) *$(DLSUFFIX)
60+
rm -f *~ *# *.b *.o *.output *.tab.h $(MODNAME)parse.h $(MODNAME)parse.c $(MODNAME)scan.c
61+
62+
ifeq (depend,$(wildcard depend))
63+
include depend
64+
endif

‎contrib/intarray/README.intarray

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
This is an implementation of RD-tree data structure using GiST interface
2+
of PostgreSQL. It has built-in lossy compression - must be declared
3+
in index creation - with (islossy). Current implementation has index support
4+
for one-dimensional array of int4's.
5+
All work was done by Teodor Sigaev (teodor@stack.net) and Oleg Bartunov
6+
(oleg@sai.msu.su). See http://www.sai.msu.su/~megera/postgres/gist
7+
for additional information.
8+
9+
INSTALLATION:
10+
11+
gmake
12+
gmake install
13+
-- load functions
14+
psql <database> < _int.sql
15+
16+
REGRESSION TEST:
17+
18+
gmake installcheck
19+
20+
EXAMPLE USAGE:
21+
22+
create table message (mid int not null,sections int[]);
23+
create table message_section_map (mid int not null,sid int not null);
24+
25+
-- create indices
26+
CREATE unique index message_key on message ( mid );
27+
CREATE unique index message_section_map_key2 on message_section_map (sid, mid );
28+
CREATE INDEX message_rdtree_idx on message using gist ( sections ) with ( islossy );
29+
30+
-- select some messages with section in 1 OR 2 - OVERLAP operator
31+
select message.mid from message where message.sections && '{1,2}';
32+
33+
-- select messages contains in sections 1 AND 2 - CONTAINS operator
34+
select message.mid from message where message.sections @ '{1,2}';
35+
-- the same, CONTAINED operator
36+
select message.mid from message where '{1,2}' ~ message.sections;
37+
38+
BENCHMARK:
39+
40+
subdirectory bench contains benchmark suite.
41+
cd ./bench
42+
1. createdb TEST
43+
2. psql TEST < ../_int.sql
44+
3. ./create_test.pl | psql TEST
45+
4. ./bench.pl - perl script to benchmark queries, supports OR, AND queries
46+
with/without RD-Tree. Run script without arguments to
47+
see availbale options.
48+
49+
a)test without RD-Tree (OR)
50+
./bench.pl -d TEST -s 1,2 -v
51+
b)test with RD-Tree
52+
./bench.pl -d TEST -s 1,2 -v -r
53+
54+
BENCHMARKS:
55+
56+
Size of table <message>: 200000
57+
Size of table <message_section_map>: 268538
58+
59+
Distribution of messages by sections:
60+
61+
section 0: 73899 messages
62+
section 1: 16298 messages
63+
section 50: 1241 messages
64+
section 99: 705 messages
65+
66+
old - without RD-Tree support,
67+
new - with RD-Tree
68+
69+
+----------+---------------+----------------+
70+
|Search set|OR, time in sec|AND, time in sec|
71+
| +-------+-------+--------+-------+
72+
| | old | new | old | new |
73+
+----------+-------+-------+--------+-------+
74+
| 1| 1.427| 0.215| -| -|
75+
+----------+-------+-------+--------+-------+
76+
| 99| 1.029| 0.018| -| -|
77+
+----------+-------+-------+--------+-------+
78+
| 1,2| 1.829| 0.334| 5.654| 0.042|
79+
+----------+-------+-------+--------+-------+
80+
| 1,2,50,60| 2.057| 0.359| 5.044| 0.007|
81+
+----------+-------+-------+--------+-------+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp