Re: Locks analysis after-the-fact

2018-05-01 Thread Merlin Moncure
On Fri, Apr 27, 2018 at 2:55 AM, Olivier Macchioni wrote: > Hello all, > > PostgreSQL version 9.4.17 > > We have a number of queries running on the same DB from many systems. Among > other things, we need to INSERT / UPDATE on a table based on external events > - this is done via a pool of 5 SQL

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 --

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

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 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

extension dependencies with 'requires'

2018-05-01 Thread Eric Hanson
Greetings, I'm trying to author an extension and running into troubles with dependencies. The extension depends on the uuid-ossp, pgcrypto and postgres_fdw extensions, but I would like the dependencies to be installed in the public schema, though the extension itself lives in its own schema. Is t

Re: extension dependencies with 'requires'

2018-05-01 Thread Tom Lane
Eric Hanson writes: > I'm trying to author an extension and running into troubles with > dependencies. The extension depends on the uuid-ossp, pgcrypto and > postgres_fdw extensions, but I would like the dependencies to be installed > in the public schema, though the extension itself lives in its

Re: extension dependencies with 'requires'

2018-05-01 Thread Eric Hanson
Ok thanks. FWIW, this pretty profoundly limits what you can do with dependencies in extensions that define their own schema: When two extensions that both define their own schema need to share the same dependency, sounds like that is impossible, because the dependency extensions can't be installe