X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 04D129DC809 for ; Mon, 9 Jan 2006 14:41:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76490-05 for ; Mon, 9 Jan 2006 14:41:16 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 8FD809DC806 for ; Mon, 9 Jan 2006 14:41:14 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k09If5rr006720; Mon, 9 Jan 2006 13:41:05 -0500 (EST) To: Alessandro Baretta cc: Matteo Beccati , pgsql-performance@postgresql.org Subject: Re: 500x speed-down: Wrong query plan? In-reply-to: <43C28DEA.60801@barettadeit.com> References: <43C26A5F.7040702@barettadeit.com> <43C27AFA.7060604@beccati.com> <43C28DEA.60801@barettadeit.com> Comments: In-reply-to Alessandro Baretta message dated "Mon, 09 Jan 2006 17:23:06 +0100" Date: Mon, 09 Jan 2006 13:41:05 -0500 Message-ID: <6719.1136832065@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.076 required=5 tests=[AWL=0.076] X-Spam-Score: 0.076 X-Spam-Level: X-Archive-Number: 200601/63 X-Sequence-Number: 16541 Alessandro Baretta writes: > Matteo Beccati wrote: >> Are you sure that you recentrly ANALYZED the table "ubicazione"? If so, >> try to increase statistics for the id_ente column. > No, this is not the problem. I increased the amount of statistics with ALTER > TABLE ... SET STATISTICS 1000, which is as much as I can have. What Matteo wanted to know is if you'd done an ANALYZE afterward. ALTER TABLE SET STATISTICS doesn't in itself update the statistics. What do you get from EXPLAIN SELECT * FROM articolo WHERE articolo.xdbs_modified > '2006-01-08 18:25:00+01'; I'm curious to see how many rows the planner thinks this will produce, and whether it will use the index or not. Also, I gather from the plan choices that the condition id_ente = 'dmd' isn't very selective ... what fraction of the rows in each table satisfy that? regards, tom lane