new module contrib/tree for 7.2 ?

Oleg Bartunov <oleg@sai.msu.su>

From: Oleg Bartunov <oleg@sai.msu.su>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2002-01-25T14:08:38Z
Lists: pgsql-hackers
Hi,

Is't late to submit new contrib module for 7.2 ?
It's almost ready and tested, we have to write README.tree.

New module creates new data types 'tree', 'treequery' for tree-like data and
provides indexed access methods using Btree or GiST.
Node represents as a path to the root, so record like '3.4' means
4-th child of 3-rd child of the root node.
Due-to bit-representation there is a limitation to the number of
children - 64 and defined in compile time (valid values - 8,16,32,64).
For practical purposes 64 children looks quite enough.
insert,delete operations should be ok, while move operations
is a pain - one should update all paths of children nodes.
But search is very fast, we use data from Open Directory catalog (www.dmoz.org)
for testing:

Select all countries:

dmoz64=# explain analyze select * from dmoz where tid <* '18.*.0';
NOTICE:  QUERY PLAN:

Index Scan using tid_g_idx on dmoz  (cost=0.00..1094.10 rows=277 width=100) (actual time=3.54..23.76 rows=56 loops=1)
Total runtime: 23.96 msec

EXPLAIN
dmoz64=#

       name         |             strid             |   id   |  tid
---------------------+-------------------------------+--------+-------
 Tagalog             | Top/World/Tagalog             | 276537 | 18.18
 Taiwanese           | Top/World/Taiwanese           | 276566 | 18.19
 Tamil               | Top/World/Tamil               | 276567 | 18.20
 Telugu              | Top/World/Telugu              | 276568 | 18.21
 Thai                | Top/World/Thai                | 276601 | 18.22
 Ukrainian           | Top/World/Ukrainian           | 276602 | 18.23
 Vietnamese          | Top/World/Vietnamese          | 276603 | 18.24
 Japanese            | Top/World/Japanese            | 268629 | 18.31
 Kiswahili           | Top/World/Kiswahili           | 268630 | 18.32
 Afrikaans           | Top/World/Afrikaans           | 256813 | 18.1
 Italiano            | Top/World/Italiano            | 266163 | 18.30
 Interlingua         | Top/World/Interlingua         | 266144 | 18.29
 Indonesia           | Top/World/Indonesia           | 265859 | 18.28
 Croatian            | Top/World/Croatian            | 257063 | 18.12
....................................................................



	Regards,
		Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83