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: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to