Re: [HACKERS] Using Index-only scans to speed up count(*)

2014-06-07 Thread Noah Misch
On Sat, Jun 07, 2014 at 08:35:27AM -0400, Gurjeet Singh wrote: > While reading [1] in context of Postgres Hibernator, I see that > Mitsuru mentioned one of the ways other RDBMS allows count(*) to be > driven by an index. > > > 'select /*+ INDEX(emp emp_pk) */ count(*) from emp;' to load index bloc

Re: [HACKERS] Using Index-only scans to speed up count(*)

2014-06-07 Thread Cédric Villemain
Le samedi 7 juin 2014 09:09:00 Gurjeet Singh a écrit : > On Sat, Jun 7, 2014 at 8:56 AM, Cédric Villemain wrote: > > Le samedi 7 juin 2014 08:35:27 Gurjeet Singh a écrit : > >> PS: Please note that I am not proposing to add support for the > >> optimizer hint embedded in Mitsuru's query. > >> >

Re: [HACKERS] Using Index-only scans to speed up count(*)

2014-06-07 Thread Gurjeet Singh
On Sat, Jun 7, 2014 at 8:56 AM, Cédric Villemain wrote: > Le samedi 7 juin 2014 08:35:27 Gurjeet Singh a écrit : > >> PS: Please note that I am not proposing to add support for the >> optimizer hint embedded in Mitsuru's query. > > :-) Even though I (sometimes) favor hints, and developed the opti

Re: [HACKERS] Using Index-only scans to speed up count(*)

2014-06-07 Thread Cédric Villemain
Le samedi 7 juin 2014 08:35:27 Gurjeet Singh a écrit : > While reading [1] in context of Postgres Hibernator, I see that > Mitsuru mentioned one of the ways other RDBMS allows count(*) to be > driven by an index. > > > 'select /*+ INDEX(emp emp_pk) */ count(*) from emp;' to load index > > blocks >

[HACKERS] Using Index-only scans to speed up count(*)

2014-06-07 Thread Gurjeet Singh
While reading [1] in context of Postgres Hibernator, I see that Mitsuru mentioned one of the ways other RDBMS allows count(*) to be driven by an index. > 'select /*+ INDEX(emp emp_pk) */ count(*) from emp;' to load index blocks I am not sure if Postgres planner already allows this, but it would b