Re: [GENERAL] Index-only scan on GIN index for COUNT() queries

2017-06-15 Thread Alexander Kuzmenkov

On 15.06.2017 17:43, Seamus Abshere wrote:


Theoretically, could support be added for Index-only scans on GIN
indexes when only a COUNT() is requested?

Hi Seamus,

I am working on a patch that adds this possibility for GIN and any other 
indexes that support bitmap scans.
You can follow the development progress in this thread: 
https://www.postgresql.org/message-id/flat/ca192322-29fd-9e60-3766-fe5e69d1f9af%40postgrespro.ru#ca192322-29fd-9e60-3766-fe5e69d1f...@postgrespro.ru


--
Alexander Kuzmenkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Index-only scan on GIN index for COUNT() queries

2017-06-15 Thread Seamus Abshere
hi,

We have a GIN index on jsonb_col. We always get Bitmap Index Scan +
Bitmap Heap Scan when we do things like

SELECT COUNT(*) FROM mytable WHERE jsonb_col ? 'key1'

Theoretically, could support be added for Index-only scans on GIN
indexes when only a COUNT() is requested?

Thanks,
Seamus

PS. Here is the real query analyze:
https://gist.github.com/seamusabshere/b9d72132361fa598f7a431fa1bcb120f

--
Seamus Abshere, SCEA
http://faraday.io
https://github.com/seamusabshere
http://linkedin.com/in/seamusabshere


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general