Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 47B884750F5 for ; Sun, 28 Jul 2002 13:22:04 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g6SHM2Vk011601; Sun, 28 Jul 2002 13:22:02 -0400 (EDT) To: "Gaetano Mendola" Cc: pgsql-admin@postgresql.org Subject: Re: cpu_tuple_cost WRONG -> After an "analyze" or "vacuum full" indexes are not used anymore!!! In-reply-to: <014c01c2361e$62a53c30$1aadd6c2@GMENDOLA2> References: <014c01c2361e$62a53c30$1aadd6c2@GMENDOLA2> Comments: In-reply-to "Gaetano Mendola" message dated "Sun, 28 Jul 2002 12:06:04 +0200" Date: Sun, 28 Jul 2002 13:22:02 -0400 Message-ID: <11600.1027876922@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200207/390 X-Sequence-Number: 5074 "Gaetano Mendola" writes: > I'm going to set the parameter cpu_tuple_cost = 0.1 to > my server, I'm wrong ? This seems very excessively high. 1.0 corresponds to one disk read, which is in the several-milliseconds range on most modern systems. You're essentially claiming that your CPU requires about a millisecond for per-tuple overhead, which is way off base (unless you're using an 8086 or some such...) My feeling is that the default value of 0.01 is already on the high side, and getting more so as CPUs get faster compared to disks. It's always possible to force the optimizer to choose "the right answer" in one particular case by pushing out some parameter setting far beyond the reasonable range, but I think you'll find that this answer breaks more stuff than it fixes. A saner way of tweaking the index-vs-seqscan costs is to reduce random_page_cost a little --- the default is 4.0 which may be on the high side. (But don't push it below 1.0.) regards, tom lane