X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2758BD8FC3 for ; Wed, 21 Sep 2005 15:38:07 -0300 (ADT) 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 67799-05 for ; Wed, 21 Sep 2005 18:37:55 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 215D6D9BA2 for ; Wed, 21 Sep 2005 15:37:55 -0300 (ADT) Received: (qmail 29228 invoked by uid 500); 21 Sep 2005 18:38:37 -0000 Date: Wed, 21 Sep 2005 13:38:37 -0500 From: Bruno Wolff III To: Sean Davis Cc: pgsql-sql@postgresql.org Subject: Re: R-tree and start/end queries Message-ID: <20050921183837.GA27439@wolff.to> Mail-Followup-To: Bruno Wolff III , Sean Davis , pgsql-sql@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/188 X-Sequence-Number: 22735 On Wed, Sep 21, 2005 at 13:52:40 -0400, Sean Davis wrote: > I have a table like: > > Create table gf ( > pk serial, > start int, > end int, > gf varchar > ); > > I want to do queries along the lines of: > > "find all gf that overlap with (10000,20000)" or > "find all gf that overlap with each other" > > And others. I have read over the documentation, but I still remain unclear > about how to implement R-tree indexing in this situation. Any suggestions? There is a built in type for line segments that uses floating point. That will probably be usable by you directly unless the integers can can large enough that precision is a problem. There is an overlaps operator for the geometric types that could be used to answer your sample questions.