Re: Ltree usage.. - Mailing list pgsql-sql

From Oleg Bartunov
Subject Re: Ltree usage..
Date
Msg-id Pine.GSO.4.44.0208021956550.17250-100000@ra.sai.msu.su
Whole thread Raw
In response to Ltree usage..  ("Rajesh Kumar Mallah." <mallah@trade-india.com>)
Responses Re: Ltree usage..
List pgsql-sql
On Fri, 2 Aug 2002, Rajesh Kumar Mallah. wrote:

>
> Hi Oleg,
>
> I am trying to use contrib/ltree for one of my applications.
>
> the query below works fine for me.
>
> Qry1: SELECT   path   from  unified_data where path ~ '*.180.*'  and path ~ '*.1.*';
>
> is there any way of compacting it for example
>
> Qry2: SELECT   path   from  unified_data where path ~ '*.180.*'  or path ~ '*.1.*'; is better
> written as
> Qry3: SELECT   path   from  unified_data where path ~ '*.180|1.*' ;

Qry2 and Qry3 are equvalent and Qry3 is faster but not much.
But Qry1 is not the same as Qry2 !!!

Qry1 could be rewritten as:

SELECT   path   from  unified_data where path @ '180 & 1';

>
> also is qry3 better to Qry2 in terms of performance?
>
> regds
> mallah.
>
>
>
>
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



pgsql-sql by date:

Previous
From: "Rajesh Kumar Mallah."
Date:
Subject: Ltree usage..
Next
From: Stephan Szabo
Date:
Subject: Re: Seeking advice regarding a design problem