Re: index-only scans

Поиск
Список
Период
Сортировка
От PostgreSQL - Hans-Jürgen Schönig
Тема Re: index-only scans
Дата
Msg-id B73620EB-2CA2-40EF-8D72-ADFA75D57105@cybertec.at
обсуждение исходный текст
Ответ на Re: index-only scans  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Ответы Re: index-only scans  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Aug 12, 2011, at 10:03 PM, Heikki Linnakangas wrote:

> On 11.08.2011 23:06, Robert Haas wrote:
>> Comments, testing, review appreciated...
>
> I would've expected this to use an index-only scan:
>
> postgres=# CREATE TABLE foo AS SELECT generate_series(1,100000) AS id;
> SELECT 100000
> postgres=# CREATE INDEX i_foo ON foo (id) WHERE id = 10;
> CREATE INDEX
> postgres=# VACUUM ANALYZE foo;
> VACUUM
> postgres=# EXPLAIN SELECT id FROM foo WHERE id = 10;
>                           QUERY PLAN
> -----------------------------------------------------------------
> Index Scan using i_foo on foo  (cost=0.00..8.27 rows=1 width=4)
>   Index Cond: (id = 10)
> (2 rows)
>
> If it's not a predicate index, then it works:
>
> postgres=# DROP INDEX i_foo;
> DROP INDEX
> postgres=# EXPLAIN SELECT id FROM foo WHERE id = 10;
>                              QUERY PLAN
> -----------------------------------------------------------------------
> Index Only Scan using i_foo2 on foo  (cost=0.00..8.28 rows=1 width=4)
>   Index Cond: (id = 10)
> (2 rows)


is there any plan to revise the cost for index only scans compared to what it is now?
many thanks,
    hans

--
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: psql: bogus descriptions displayed by \d+
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Extra check in 9.0 exclusion constraint unintended consequences