X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2FF523A407E for ; Wed, 17 Nov 2004 09:29:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89257-09 for ; Wed, 17 Nov 2004 09:29:33 +0000 (GMT) Received: from matrix.gatewaynet.com (matrix.gatewaynet.com [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 011873A4315 for ; Wed, 17 Nov 2004 09:29:34 +0000 (GMT) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id iAHA0W5x008195; Wed, 17 Nov 2004 12:00:32 +0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id iAHA0W4a008191; Wed, 17 Nov 2004 12:00:32 +0200 Date: Wed, 17 Nov 2004 12:00:32 +0200 (EET) From: Achilleus Mantzios To: Oleg Bartunov Cc: Gary Stainburn , sad , Subject: Re: tree structure photo gallery date quiery In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/166 X-Sequence-Number: 19485 O Oleg Bartunov έγραψε στις Nov 17, 2004 : > Gary, > > if you need really fast solution for you task and dont't afraid > non-standard soltion, take a look on contrib/ltree module. > http://www.sai.msu.su/~megera/postgres/gist/ltree/ > > Oleg Oleg how would you compare an ltree solution against a genealogical approach using intarray?? i.e. store for each node, its path to root, e.g. path='{4,2,7}'::int4[] where 4 is the id of the father, 2 of the grandfather, and 7 of the root, whereas root has path is null. That way we can do really fast queries using ~, have indexes on level (path length),first (immediate ancestor),last (root) using C functions that we can easily write and so forth. I have extensively used this approach with success. Can you comment on the pros and cons of each? (int[] with intarray vs ltree). Thanx > _____________________________________________________________ > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match > -- -Achilleus