From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Surprised by index choice for count(*)
Date: Tue, 01 May 2018 12:11:12 -0400
Message-ID: <31534.1525191072@sss.pgh.pa.us> (raw)
In-Reply-To: <38fc1d14-1207-cbca-18e0-b2e6f269565b@gmail.com>
References: <38fc1d14-1207-cbca-18e0-b2e6f269565b@gmail.com>
Rob Sargent <robjsargent@gmail.com> writes:
> Should I be? I would have thought the pk would have been chosen v.
> function index?
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.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, robjsargent@gmail.com
Subject: Re: Surprised by index choice for count(*)
In-Reply-To: <31534.1525191072@sss.pgh.pa.us>
References: <38fc1d14-1207-cbca-18e0-b2e6f269565b@gmail.com> <31534.1525191072@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox