pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedIs this the most efficent way to child nodes off a N-ary node database?
2+ messages / 2 participants
[nested] [flat]
* Is this the most efficent way to child nodes off a N-ary node database?
@ 2002-02-14 18:52 Christian Brink <cb@onsitetech.com>
2002-02-14 19:37 ` Re: Is this the most efficent way to child nodes off a N-ary Oleg Bartunov <oleg@sai.msu.su>
0 siblings, 1 reply; 2+ messages in thread
From: Christian Brink @ 2002-02-14 18:52 UTC (permalink / raw)
To: pgsql-sql
I have created this SQL statment, used to pull the child/leaf nodes off of a
N-ary node structure in PostgreSQL.
Is my premise all wrong?
Is this efficent as a SQL select?
Should this be done in my code (something I try to avoid for abstraction
reasons)?
"SELECT DISTINCT t1.node_id FROM node t1 WHERE NOT EXISTS (SELECT
t1.node_id FROM node t2 WHERE t1.node_id = t2.parent_id);"
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Is this the most efficent way to child nodes off a N-ary
2002-02-14 18:52 Is this the most efficent way to child nodes off a N-ary node database? Christian Brink <cb@onsitetech.com>
@ 2002-02-14 19:37 ` Oleg Bartunov <oleg@sai.msu.su>
0 siblings, 0 replies; 2+ messages in thread
From: Oleg Bartunov @ 2002-02-14 19:37 UTC (permalink / raw)
To: Christian Brink <cb@onsitetech.com>; +Cc: pgsql-sql
Christian,
take a look at our contrib/tree module, available from
http://www.sai.msu.su/~megera/postgres/gist/
Oleg
On Thu, 14 Feb 2002, Christian Brink wrote:
> I have created this SQL statment, used to pull the child/leaf nodes off of a
> N-ary node structure in PostgreSQL.
>
> Is my premise all wrong?
>
> Is this efficent as a SQL select?
>
> Should this be done in my code (something I try to avoid for abstraction
> reasons)?
>
> "SELECT DISTINCT t1.node_id FROM node t1 WHERE NOT EXISTS (SELECT
> t1.node_id FROM node t2 WHERE t1.node_id = t2.parent_id);"
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-02-14 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-02-14 18:52 Is this the most efficent way to child nodes off a N-ary node database? Christian Brink <cb@onsitetech.com>
2002-02-14 19:37 ` Re: Is this the most efficent way to child nodes off a N-ary Oleg Bartunov <oleg@sai.msu.su>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox