Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
4bcb80a3
Commit
4bcb80a3
authored
Mar 17, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update contrib intarray to Jan 25 version.
parent
5a38af7f
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
816 additions
and
266 deletions
+816
-266
contrib/intarray/Makefile
contrib/intarray/Makefile
+24
-11
contrib/intarray/README.intarray
contrib/intarray/README.intarray
+7
-3
contrib/intarray/_int.c
contrib/intarray/_int.c
+633
-250
contrib/intarray/_int.sql.in
contrib/intarray/_int.sql.in
+113
-1
contrib/intarray/bench/create_test.pl
contrib/intarray/bench/create_test.pl
+1
-1
contrib/intarray/expected/_int.out
contrib/intarray/expected/_int.out
+27
-0
contrib/intarray/sql/_int.sql
contrib/intarray/sql/_int.sql
+11
-0
No files found.
contrib/intarray/Makefile
View file @
4bcb80a3
# $Header: /cvsroot/pgsql/contrib/intarray/Makefile,v 1.3 2001/02/20 19:20:27 petere Exp $
subdir
=
contrib/intarray
subdir
=
contrib/intarray
top_builddir
=
../..
top_builddir
=
../..
include
$(top_builddir)/src/Makefile.global
include
$(top_builddir)/src/Makefile.global
...
@@ -12,7 +10,7 @@ NAME= _int
...
@@ -12,7 +10,7 @@ NAME= _int
SO_MAJOR_VERSION
=
1
SO_MAJOR_VERSION
=
1
SO_MINOR_VERSION
=
0
SO_MINOR_VERSION
=
0
override CPPFLAGS
:
= -I$(srcdir) $(CPPFLAGS
) -DPGSQL71
override
CPPFLAGS
+=
-I
$(srcdir
)
-DPGSQL71
OBJS
=
_int.o
OBJS
=
_int.o
...
@@ -23,31 +21,46 @@ include $(top_srcdir)/src/Makefile.shlib
...
@@ -23,31 +21,46 @@ include $(top_srcdir)/src/Makefile.shlib
$(NAME).sql
:
$(NAME).sql.in
$(NAME).sql
:
$(NAME).sql.in
sed
's,MODULE_PATHNAME,
$(libdir)
/
$(shlib)
,g'
$<
>
$@
sed
-e
's:MODULE_PATHNAME:
$(libdir)
/
$(shlib)
:g'
<
$<
>
$@
.PHONY
:
submake
.PHONY
:
submake
submake
:
submake
:
$(MAKE)
-C
$(top_builddir)
/src/test/regress pg_regress
$(MAKE)
-C
$(top_builddir)
/src/test/regress pg_regress
# against installed postmaster
installcheck
:
submake
installcheck
:
submake
$(top_builddir)
/src/test/regress/pg_regress _int
$(top_builddir)
/src/test/regress/pg_regress _int
# in-tree test doesn't work yet (no way to install my shared library)
#check: all submake
# $(top_builddir)/src/test/regress/pg_regress --temp-install \
# --top-builddir=$(top_builddir) _int
check
:
check
:
@
echo
"'
$(MAKE)
check' is not supported."
@
echo
"'
make
check' is not supported."
@
echo
"Do '
$(MAKE)
install', then '
$(MAKE)
installcheck' instead."
@
echo
"Do '
make install', then 'make
installcheck' instead."
install
:
all installdirs install-lib
install
:
all installdirs install-lib
$(INSTALL_DATA)
$(srcdir)
/README.intarray
$(docdir)
/contrib
#
$(INSTALL_DATA)
$(srcdir)
/README.
$(NAME)
$(docdir)
/contrib
$(INSTALL_DATA)
$(NAME)
.sql
$(datadir)
/contrib
$(INSTALL_DATA)
$(NAME)
.sql
$(datadir)
/contrib
installdirs
:
installdirs
:
$(mkinstalldirs)
$(docdir)
/contrib
$(datadir)
/contrib
$(libdir)
$(mkinstalldirs)
$(docdir)
/contrib
$(datadir)
/contrib
$(libdir)
uninstall
:
uninstall-lib
uninstall
:
uninstall-lib
rm
-f
$(docdir)
/contrib/README.
intarray
$(datadir)
/contrib/
$(NAME)
.sql
rm
-f
$(docdir)
/contrib/README.
$(NAME)
$(datadir)
/contrib/
$(NAME)
.sql
clean distclean maintainer-clean
:
clean-lib
clean distclean maintainer-clean
:
clean-lib
rm
-f
$(OBJS)
$(NAME)
.sql
rm
-f
*
.so y.tab.c y.tab.h
$(OBJS)
$(NAME)
.sql
# things created by various check targets
# things created by various check targets
rm
-rf
results
rm
-rf
results
tmp_check
log
rm
-f
regression.diffs
regression.out
rm
-f
regression.diffs
regression.out
regress.out
run_check.out
ifeq
($(PORTNAME), win)
rm
-f
regress.def
endif
depend dep
:
$(CC)
-MM
$(CFLAGS)
*
.c
>
depend
ifeq
(depend,$(wildcard depend))
include
depend
endif
contrib/intarray/README.intarray
View file @
4bcb80a3
This is an implementation of RD-tree data structure using GiST interface
This is an implementation of RD-tree data structure using GiST interface
of PostgreSQL. It has built-in lossy compression - must be declared
of PostgreSQL. It has built-in lossy compression - must be declared
in index creation - with (islossy). Current implementation has index support
in index creation - with (islossy). Current implementation provides index
for one-dimensional array of int4's.
support for one-dimensional array of int4's - gist__int_ops, suitable for
small and medium size of arrays (used on default), and gist__intbig_ops for
indexing large arrays (we use superimposed signature with length of 4096
bits to represent sets).
All work was done by Teodor Sigaev (teodor@stack.net) and Oleg Bartunov
All work was done by Teodor Sigaev (teodor@stack.net) and Oleg Bartunov
(oleg@sai.msu.su). See http://www.sai.msu.su/~megera/postgres/gist
(oleg@sai.msu.su). See http://www.sai.msu.su/~megera/postgres/gist
for additional information.
for additional information.
...
@@ -25,7 +29,7 @@ EXAMPLE USAGE:
...
@@ -25,7 +29,7 @@ EXAMPLE USAGE:
-- create indices
-- create indices
CREATE unique index message_key on message ( mid );
CREATE unique index message_key on message ( mid );
CREATE unique index message_section_map_key2 on message_section_map (sid, mid );
CREATE unique index message_section_map_key2 on message_section_map (sid, mid );
CREATE INDEX message_rdtree_idx on message using gist ( sections ) with ( islossy );
CREATE INDEX message_rdtree_idx on message using gist ( sections
gist__int_ops
) with ( islossy );
-- select some messages with section in 1 OR 2 - OVERLAP operator
-- select some messages with section in 1 OR 2 - OVERLAP operator
select message.mid from message where message.sections && '{1,2}';
select message.mid from message where message.sections && '{1,2}';
...
...
contrib/intarray/_int.c
View file @
4bcb80a3
This diff is collapsed.
Click to expand it.
contrib/intarray/_int.sql.in
View file @
4bcb80a3
-- Create the user-defined type for the 1-D
frloating point inderval
s (_int4)
-- Create the user-defined type for the 1-D
integer array
s (_int4)
--
--
BEGIN TRANSACTION;
BEGIN TRANSACTION;
...
@@ -208,4 +208,116 @@ INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
...
@@ -208,4 +208,116 @@ INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
WHERE amname = 'gist' and opcname = 'gist__int_ops'
WHERE amname = 'gist' and opcname = 'gist__int_ops'
and proname = 'g_int_same';
and proname = 'g_int_same';
---------------------------------------------
-- intbig
---------------------------------------------
-- define the GiST support methods
CREATE FUNCTION g_intbig_consistent(opaque,_int4,int4) RETURNS bool
AS 'MODULE_PATHNAME' LANGUAGE 'c';
CREATE FUNCTION g_intbig_compress(opaque) RETURNS opaque
AS 'MODULE_PATHNAME' LANGUAGE 'c';
CREATE FUNCTION g_intbig_decompress(opaque) RETURNS opaque
AS 'MODULE_PATHNAME' LANGUAGE 'c';
CREATE FUNCTION g_intbig_penalty(opaque,opaque,opaque) RETURNS opaque
AS 'MODULE_PATHNAME' LANGUAGE 'c';
CREATE FUNCTION g_intbig_picksplit(opaque, opaque) RETURNS opaque
AS 'MODULE_PATHNAME' LANGUAGE 'c';
CREATE FUNCTION g_intbig_union(bytea, opaque) RETURNS _int4
AS 'MODULE_PATHNAME' LANGUAGE 'c';
CREATE FUNCTION g_intbig_same(_int4, _int4, opaque) RETURNS opaque
AS 'MODULE_PATHNAME' LANGUAGE 'c';
-- register the default opclass for indexing
INSERT INTO pg_opclass (opcname, opcdeftype)
values ( 'gist__intbig_ops', 0 );
-- get the comparators for _intments and store them in a tmp table
SELECT o.oid AS opoid, o.oprname
INTO TABLE _int_ops_tmp
FROM pg_operator o, pg_type t
WHERE o.oprleft = t.oid and o.oprright = t.oid
and t.typname = '_int4';
-- make sure we have the right operators
-- SELECT * from _int_ops_tmp;
-- using the tmp table, generate the amop entries
-- _int_overlap
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
SELECT am.oid, opcl.oid, c.opoid, 3
FROM pg_am am, pg_opclass opcl, _int_ops_tmp c
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and c.oprname = '&&';
-- _int_contains
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
SELECT am.oid, opcl.oid, c.opoid, 7
FROM pg_am am, pg_opclass opcl, _int_ops_tmp c
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and c.oprname = '@';
-- _int_contained
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
SELECT am.oid, opcl.oid, c.opoid, 8
FROM pg_am am, pg_opclass opcl, _int_ops_tmp c
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and c.oprname = '~';
DROP TABLE _int_ops_tmp;
-- add the entries to amproc for the support methods
-- note the amprocnum numbers associated with each are specific!
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
SELECT am.oid, opcl.oid, pro.oid, 1
FROM pg_am am, pg_opclass opcl, pg_proc pro
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and proname = 'g_intbig_consistent';
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
SELECT am.oid, opcl.oid, pro.oid, 2
FROM pg_am am, pg_opclass opcl, pg_proc pro
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and proname = 'g_intbig_union';
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
SELECT am.oid, opcl.oid, pro.oid, 3
FROM pg_am am, pg_opclass opcl, pg_proc pro
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and proname = 'g_intbig_compress';
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
SELECT am.oid, opcl.oid, pro.oid, 4
FROM pg_am am, pg_opclass opcl, pg_proc pro
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and proname = 'g_intbig_decompress';
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
SELECT am.oid, opcl.oid, pro.oid, 5
FROM pg_am am, pg_opclass opcl, pg_proc pro
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and proname = 'g_intbig_penalty';
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
SELECT am.oid, opcl.oid, pro.oid, 6
FROM pg_am am, pg_opclass opcl, pg_proc pro
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and proname = 'g_intbig_picksplit';
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
SELECT am.oid, opcl.oid, pro.oid, 7
FROM pg_am am, pg_opclass opcl, pg_proc pro
WHERE amname = 'gist' and opcname = 'gist__intbig_ops'
and proname = 'g_intbig_same';
END TRANSACTION;
END TRANSACTION;
contrib/intarray/bench/create_test.pl
View file @
4bcb80a3
...
@@ -49,7 +49,7 @@ print <<EOT;
...
@@ -49,7 +49,7 @@ print <<EOT;
CREATE unique index message_key on message ( mid );
CREATE unique index message_key on message ( mid );
--CREATE unique index message_section_map_key1 on message_section_map ( mid, sid );
--CREATE unique index message_section_map_key1 on message_section_map ( mid, sid );
CREATE unique index message_section_map_key2 on message_section_map ( sid, mid );
CREATE unique index message_section_map_key2 on message_section_map ( sid, mid );
CREATE INDEX message_rdtree_idx on message using gist ( sections ) with ( islossy );
CREATE INDEX message_rdtree_idx on message using gist ( sections
gist__int_ops
) with ( islossy );
VACUUM ANALYZE;
VACUUM ANALYZE;
select count(*) from message;
select count(*) from message;
...
...
contrib/intarray/expected/_int.out
View file @
4bcb80a3
...
@@ -17,3 +17,30 @@ SELECT count(*) from test__int WHERE a @ '{23,50}';
...
@@ -17,3 +17,30 @@ SELECT count(*) from test__int WHERE a @ '{23,50}';
12
12
(1 row)
(1 row)
CREATE INDEX text_idx on test__int using gist ( a gist__int_ops ) with ( islossy );
SELECT count(*) from test__int WHERE a && '{23,50}';
count
-------
345
(1 row)
SELECT count(*) from test__int WHERE a @ '{23,50}';
count
-------
12
(1 row)
drop index text_idx;
CREATE INDEX text_idx on test__int using gist ( a gist__intbig_ops ) with ( islossy );
SELECT count(*) from test__int WHERE a && '{23,50}';
count
-------
345
(1 row)
SELECT count(*) from test__int WHERE a @ '{23,50}';
count
-------
12
(1 row)
contrib/intarray/sql/_int.sql
View file @
4bcb80a3
...
@@ -13,3 +13,14 @@ CREATE TABLE test__int( a int[] );
...
@@ -13,3 +13,14 @@ CREATE TABLE test__int( a int[] );
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{23,50}'
;
CREATE
INDEX
text_idx
on
test__int
using
gist
(
a
gist__int_ops
)
with
(
islossy
);
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{23,50}'
;
drop
index
text_idx
;
CREATE
INDEX
text_idx
on
test__int
using
gist
(
a
gist__intbig_ops
)
with
(
islossy
);
SELECT
count
(
*
)
from
test__int
WHERE
a
&&
'{23,50}'
;
SELECT
count
(
*
)
from
test__int
WHERE
a
@
'{23,50}'
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment