Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 003DB4759A0 for ; Fri, 2 Aug 2002 13:00:50 -0400 (EDT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by postgresql.org (Postfix) with ESMTP id DD20C4758FE for ; Fri, 2 Aug 2002 13:00:48 -0400 (EDT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.9.3/8.9.3) with ESMTP id UAA18232; Fri, 2 Aug 2002 20:00:38 +0300 (GMT) Date: Fri, 2 Aug 2002 20:00:38 +0300 (GMT) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: "Rajesh Kumar Mallah." Cc: pgsql-sql@postgresql.org Subject: Re: Ltree usage.. In-Reply-To: <200208022203.52617.mallah@trade-india.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/41 X-Sequence-Number: 8887 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