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 0EA4C9DCBA3 for ; Thu, 16 Feb 2006 13:28:56 -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 42314-01 for ; Thu, 16 Feb 2006 13:28:54 -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 B00D59DCB6A for ; Thu, 16 Feb 2006 13:28:53 -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 k1GHRaaL029368; Thu, 16 Feb 2006 12:27:36 -0500 (EST) To: "Adnan DURSUN" cc: pgsql-performance@postgresql.org Subject: Re: Why does not perform index combination In-reply-to: References: Comments: In-reply-to "Adnan DURSUN" message dated "Thu, 16 Feb 2006 18:56:20 +0200" Date: Thu, 16 Feb 2006 12:27:36 -0500 Message-ID: <29367.1140110856@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.11 required=5 tests=[AWL=0.110] X-Spam-Score: 0.11 X-Spam-Level: X-Archive-Number: 200602/258 X-Sequence-Number: 17244 "Adnan DURSUN" writes: > I have query for a report. Explain analyze result is below. The = > execution plan tells that it would use "t_koltuk_islem_pkey" index on = > table "t_koltuk_islem" to scan. However, there is another index on table = > "t_koltuk_islem" on column "islem_tarihi" that can be combined on plan. = > Why doesn't optimizer choice that ? It prefer to perform a filter on = > column "islem_tarihi" ... Why ? Probably thinks that the extra index doesn't add enough selectivity to be worth scanning. It's probably right, too --- maybe with a narrower date range the answer would be different. I think the main problem in this plan is the poor estimation of the size of the d1/s join. Are your stats up to date on those tables? Maybe boosting the statistics target for one or both would help. regards, tom lane