Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id B10289FA0DA for ; Tue, 4 Sep 2007 23:58:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 36281-03 for ; Tue, 4 Sep 2007 23:58:03 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.235]) by postgresql.org (Postfix) with ESMTP id 243E59F9BAC for ; Tue, 4 Sep 2007 23:58:04 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id r21so1823389wxc for ; Tue, 04 Sep 2007 19:58:02 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Al5+LgUjoOylo5iLxi1OXkeiWJ8F6kJBzQwJKSWudixV/rO0OioxRUzOk6/leJb/4YZn+eG3EeoQ5dhlcvs0sKbdrdcgdNrE6ngSQw9WDr4hvqK+I1LAHi6BnOEYPoe2YqiXathJdsJw2fEPhVVWtiic8+bdlkgmJslH/pVC184= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fWJdpT3NjrA2JGb6Q7l/tH2r4xmWEQbsiczaLqnqOt4sV6a8lpaAac0YW9Ffp5P9K8B3kuJTvZzpt/5r61FrP/HYyvXYMHX+rCgv5N586tURdrROJCVYpCBOZeLSH7l+B93CD1A4d2ix0s1/R28ctYktppKdGsU046X0YodusDk= Received: by 10.70.53.7 with SMTP id b7mr10933288wxa.1188961082816; Tue, 04 Sep 2007 19:58:02 -0700 (PDT) Received: by 10.70.90.15 with HTTP; Tue, 4 Sep 2007 19:58:02 -0700 (PDT) Message-ID: <4544e0330709041958o3bd58974gf39f64ae083c81d6@mail.gmail.com> Date: Tue, 4 Sep 2007 21:58:02 -0500 From: "Peter Koczan" To: giuseppe.derossi@email.it Subject: Re: geometry poligons performance and index Cc: pgsql-admin@postgresql.org In-Reply-To: <77edfa82157a698e4c207fcdaccc52f2@164.129.1.43> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <77edfa82157a698e4c207fcdaccc52f2@164.129.1.43> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/24 X-Sequence-Number: 26785 > The results are ok, but the query is too slow. I tried to applay a GIST and > gtree index but performance did not improve. > By explaining the query I see that the where condition gets the query slow. > Is there a more simple way to check if two poligons have a not null > intersection (they overlap)? > > Is there a kind of index I can use ? If you stored the polygon geometries in the same table, you could use a functional index (give the CREATE INDEX statement a function to evaluate rather than a column). Check the CREATE INDEX page for caveats. Beware that the index would grow with the square of the number of rows if you did it like this. Peter