From: | Thom Brown <thom(at)linux(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, depesz(at)depesz(dot)com, pgsql-general(at)postgresql(dot)org |
Subject: | Re: [9.2devel] why it doesn't do index scan only? |
Date: | 2011-10-09 20:41:01 |
Message-ID: | CAA-aLv5+J1nTJSVdy=bTVQ-p73HzNtPdpvL9nLNxA2DkTP2u7g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 9 October 2011 18:38, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2011/10/9 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>> 2011/10/9 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>>>> 2011/10/9 Thom Brown <thom(at)linux(dot)com>:
>>>>> On 9 October 2011 04:35, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>>>>>> It has a sense - index only scan it is faster (and significantly
>>>>>> faster) on wider tables - or tables with strings where TOAST is not
>>>>>> active. Maybe there is a some issue because on thin tables is slower
>>>>>> (and I expect a should be faster everywhere).
>>>
>>>>> No, that's my point, I re-tested it on a table with just 2 int
>>>>> columns, and the results are roughly the same. I added all the
>>>>> columns to make it expensive to fetch the column being queried.
>>>
>>>> then I don't understand
>>>
>>> Are you sure you've remembered to vacuum the test table? I get results
>>> like yours (ie, no speed benefit for index-only scan) if the table
>>> doesn't have its visibility-map bits set.
>>
>> it should be - I didn't do VACUUM
>>
>
> yes, After VACUUM I got a significantly better times - index only scan
> is about 5-6x better
Something that I was expecting the planner to do with this patch,
which it doesn't, is pull in the index for queries like:
SELECT count(*) from my_table;
or
SELECT sum(indexed_column) from my_table;
I don't see why a non-partial index can't fulfill these queries. I
can only get index-only scans with WHERE conditions.
--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Filip Rembiałkowski | 2011-10-09 20:52:51 | Re: Best PostGIS function for finding the nearest line segment to a given point |
Previous Message | Pavel Stehule | 2011-10-09 17:38:30 | Re: [9.2devel] why it doesn't do index scan only? |