Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 1B1B963375F for ; Sun, 10 Jan 2010 22:52:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 65958-10 for ; Mon, 11 Jan 2010 02:52:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by mail.postgresql.org (Postfix) with ESMTP id 27B986336E2 for ; Sun, 10 Jan 2010 22:52:27 -0400 (AST) Received: by fg-out-1718.google.com with SMTP id 22so548463fge.1 for ; Sun, 10 Jan 2010 18:52:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=+fkwQgOvdfL/kO4aFKZPG7qjD83wVnDs7MyNDrA8rbs=; b=ETfdjg5uz9QEq6m2Lugiw6YpXeNuM7N/zOlK+TrYGUn5mgABAJXe0Pohbc5w8awt5C SkNvORX9eGzSc8Uo3QB7nt8IvL7/XsClvfoRzY4SE9GL3jQ5XB+zo/X7wSDau/Jt4m8W 6qORf4A+akQaSAbup3gnjvCKfX2Oa96EVC+5w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=aNV0Y1gv9m1rzZTK4FVX4kfXPuaoosYOPupuA1OZ4PWdZrrep1bgbImtYFfyWMq/T9 CRQsOD7b8SynNq6Jc4ClSj5jWhGJ2hgnwPcOHccKsU9nhjGwq/smAZlrLlDKgizHgkRH Jr69eykIdtxpIZIq0WrVb2SAfPC+PuWWDcHNg= MIME-Version: 1.0 Received: by 10.239.143.133 with SMTP id k5mr923008hba.57.1263178345721; Sun, 10 Jan 2010 18:52:25 -0800 (PST) In-Reply-To: <4B49A3AF020000250002E138@gw.wicourts.gov> References: <4B49A3AF020000250002E138@gw.wicourts.gov> Date: Sun, 10 Jan 2010 21:52:25 -0500 Message-ID: <603c8f071001101852n7ce69d9atfc0b7aa65d8e357d@mail.gmail.com> Subject: Re: Choice of bitmap scan over index scan From: Robert Haas To: Kevin Grittner Cc: mathieu@dezutter.org, pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.589 tagged_above=-10 required=5 tests=BAYES_00=-2.599, FH_DATE_PAST_20XX=3.188 X-Spam-Level: X-Archive-Number: 201001/181 X-Sequence-Number: 37061 On Sun, Jan 10, 2010 at 10:53 AM, Kevin Grittner wrote: > seq_page_cost = 0.1 > random_page_cost = 0.1 These might not even be low enough. The reason why bitmap index scans win over plain index scans, in general, is because you make one pass through the heap to get all the rows you need instead of bouncing around doing lots of random access. But of course if all the data is in RAM then this argument falls down. If these aren't enough to get the query planner to DTRT, then the OP might want to try lowering them further and seeing how low he has to go to flip the plan... ...Robert