Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fDXuD-0006ye-3V for pgsql-general@arkaria.postgresql.org; Tue, 01 May 2018 16:13:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fDXuB-0008QU-Sb for pgsql-general@arkaria.postgresql.org; Tue, 01 May 2018 16:13:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fDXuB-0008QK-II for pgsql-general@lists.postgresql.org; Tue, 01 May 2018 16:13:27 +0000 Received: from mail-pf0-x229.google.com ([2607:f8b0:400e:c00::229]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fDXu8-00073J-Iw for pgsql-general@postgresql.org; Tue, 01 May 2018 16:13:27 +0000 Received: by mail-pf0-x229.google.com with SMTP id z9so9412025pfe.6 for ; Tue, 01 May 2018 09:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YCp/ebxoG+3Ix7mPDdSBJQDiGN1guM2NBcgOp0CfQUg=; b=BUrqXWEI5s/7bXV8XtolxEgMEE0GLQ6aSXy47UWKho/Z2J/vhyzHLrVrls1om7KqDz kd1io5pQ56OqFBETU5QikWGW3st5k3txLssxyoGB6YVdmWrBYwuOByTC/l8dtjph8g3i 9SZV+FHdahIsRui6x6al6cTggPA7o0U/tZq09xjnHj+2Wqb2b/CkouhNiGtWUIhqxK3z rVQiAi7lkWN9VaKzpXhvAFoubPUTW6XBHa3q8bbnX04l4ybH2EVGvJQacVzHOTGCo1Db Czkk1Ku1htBJBWXgUMzRm5ShhNxeRwfOLI6jJvqHpKzTxwMmZ+VERifJaCxbBsOzZgJs bKKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YCp/ebxoG+3Ix7mPDdSBJQDiGN1guM2NBcgOp0CfQUg=; b=QAtVAdXQjBgJ5t/FBPdV2VaItvpm1UNQUvar4hM4kQCQN+8u2/P0ENPb2u+aNFZ+LP s/oXnMt29OyAtp8ctgC37yl+BkDb+LAaDBfB5qaBmOrndNzXxJdmiI7bA4mLucmwhTkk Z/RqQ02G6YrExgrvRck0AI8AETG0f5TtN3//Hw0lTlsm0I/SrICjgiHmTcXAWnvsf2fQ KDfBS5mPDf3RKSLvcaTP5u0dhGIyh8KYoNiQeTbWeH1eqLjiAM1OPANpXqxeInDOl8vh 3ix68zj8u6c1WiyDdqMGfRFAfv/A7KEPt7Q0eYNiySXZ/nmSHXFNJY8MpCkwxSZ4NcJv wa+A== X-Gm-Message-State: ALQs6tDBR0hV1jcTkG8gtH8X4hEGsjhVlRINK1nT+D3yOtaYOSaZ5Lh4 qEveySiAn1jKdHCpB/s5dcQ= X-Google-Smtp-Source: AB8JxZrh7/aNKO5EJZDHJBdwJ85BZOv8yjkYjx/oWh7gppHi7szs3CKtVc1MbcLU9VXtyIYHe8g9qA== X-Received: by 2002:a17:902:5602:: with SMTP id h2-v6mr17113284pli.115.1525191202066; Tue, 01 May 2018 09:13:22 -0700 (PDT) Received: from kitselas.hci.utah.edu ([155.100.47.2]) by smtp.gmail.com with ESMTPSA id p11-v6sm3003200pgn.18.2018.05.01.09.13.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 May 2018 09:13:21 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: Surprised by index choice for count(*) From: Rob Sargent In-Reply-To: <31534.1525191072@sss.pgh.pa.us> Date: Tue, 1 May 2018 10:13:20 -0600 Cc: "pgsql-general@postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <59632FB7-2378-4A77-8B37-BCF5A438411F@gmail.com> References: <38fc1d14-1207-cbca-18e0-b2e6f269565b@gmail.com> <31534.1525191072@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3445.6.18) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thank you both. Simple, as expected. And I=E2=80=99m easily surprised. = =20 Version 10 (perhaps obviously) for those scoring at home. > On May 1, 2018, at 10:11 AM, Tom Lane wrote: >=20 > Rob Sargent writes: >> Should I be? I would have thought the pk would have been chosen v.=20= >> function index? >=20 > If I'm reading this correctly, the PK index contains uuids while > the fpv index contains float4s, meaning the latter is probably half > the size. So scanning it is a lot cheaper, at least according to > the planner's cost model. >=20 > regards, tom lane