Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 0CE0B632315 for ; Wed, 7 Apr 2010 18:13:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 28779-05 for ; Wed, 7 Apr 2010 21:13:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f187.google.com (mail-iw0-f187.google.com [209.85.223.187]) by mail.postgresql.org (Postfix) with ESMTP id 5B759632FB9 for ; Wed, 7 Apr 2010 18:13:19 -0300 (ADT) Received: by iwn17 with SMTP id 17so891642iwn.19 for ; Wed, 07 Apr 2010 14:13:18 -0700 (PDT) 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:received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7xidyu0bzTnuTD3JkUnt4LddPJJB/Cs6utZ5ZO2I8mc=; b=Lc/II0uYD4WyjEl8/ZGeScXDb+9WNLHAOleQKum9zCYV79FvO/1tInu8NKd5wKuo0d TAKxFW/4iQySucyvSapp5PP/ejI6NBYauH0IT1rNU2q2v7aRDH1gFGLrNrmS3QbjYFyk nyMD37jUd5UTQ0FIqKpg8+mUANIwshN4EUJog= 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:content-transfer-encoding; b=GK9Uv+G2eJQtX8bTYLQ5P9YBC7Z1CtmYDeglkRmKVjf/56NlpjcTmNzhayK6IutYUM j4nR8NxdZsC1Qzbj3+bSO+zTZ14RoOLqjVHcz8OzfSR3n09IE/bVZWeHn/gi0VEep4te BGjuqb5C7t8nc0j+GksbrWK7Dd0Imwg4oxQ2A= MIME-Version: 1.0 Received: by 10.231.19.69 with HTTP; Wed, 7 Apr 2010 14:13:18 -0700 (PDT) In-Reply-To: References: Date: Wed, 7 Apr 2010 17:13:18 -0400 Received: by 10.231.169.145 with SMTP id z17mr4287427iby.83.1270674798231; Wed, 07 Apr 2010 14:13:18 -0700 (PDT) Message-ID: Subject: Re: indexes in partitioned tables - again From: Robert Haas To: Samuel Gendler Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.396 tagged_above=-10 required=5 tests=AWL=0.047, BAYES_00=-2.599, SUBJECT_FUZZY_TION=0.156 X-Spam-Level: X-Archive-Number: 201004/71 X-Sequence-Number: 38321 On Tue, Apr 6, 2010 at 5:37 PM, Samuel Gendler wrote: > In part, I'm surprised that the index scan takes as long as it does, > since I'd think an index would be able to return the set of keys > relatively quickly.=A0 But that's a secondary issue. We don't actually have a facility built into the index-scan machinery to scan for distinct keys. It's doing a full scan of the index and then unique-ifying the results afterward. It produces the right answers, but it's definitely not as fast as it could be. The planner is not as smart about partitioned tables as it could be, either. A scan of the partitioned tables is implemented as an append node with one member per partition; and the planner isn't very good at pushing things down through append nodes. ...Robert