Re: Surprised by index choice for count(*)

2018-05-01 Thread Rob Sargent
Thank you both. Simple, as expected. And I’m easily surprised. Version 10 (perhaps obviously) for those scoring at home. > On May 1, 2018, at 10:11 AM, Tom Lane wrote: > > Rob Sargent writes: >> Should I be? I would have thought the pk would have been chosen v. >> function index? > > If

Re: Surprised by index choice for count(*)

2018-05-01 Thread Tom Lane
Rob Sargent 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 ac

Re: Surprised by index choice for count(*)

2018-05-01 Thread David G. Johnston
On Tue, May 1, 2018 at 8:46 AM, Rob Sargent wrote: > Should I be? I would have thought the pk would have been chosen v. > function index? > Indexes: > "segment_pkey" PRIMARY KEY, btree (id) > "useg" UNIQUE, btree (probandset_id, chrom, startbase, endbase) > "fpv" btree (pv(events_les

Surprised by index choice for count(*)

2018-05-01 Thread Rob Sargent
Should I be?  I would have thought the pk would have been chosen v. function index? explain analyse select count(*) from bc.segment s; QUERY PLAN --