Re: no index-usage on aggregate-functions?

Поиск
Список
Период
Сортировка
От Harald Lau (Sector-X)
Тема Re: no index-usage on aggregate-functions?
Дата
Msg-id 00b801c45db5$914330e0$6602a8c0@spock
обсуждение исходный текст
Ответ на no index-usage on aggregate-functions?  ("Harald Lau (Sector-X)" <harald@sector-x.de>)
Ответы Re: no index-usage on aggregate-functions?
Re: no index-usage on aggregate-functions?
Re: no index-usage on aggregate-functions?
Список pgsql-performance
@Chris:

> > SELECT count(*) FROM the_table
> > => Seq scan -> takes about 12 sec
> This cannot be made O(1) in postgres due to MVCC.  You just have to live
> with it.

bad news
BTW: in this case you could workaround
select reltuples from pg_class where relname='the_table'
(yes, I know: presumes a regular vacuum analyse)

> Average and sum can never use an index AFAIK, in any db server.  You
> need information from every row.

Take a look at the SQLSrv-pendant:
create index x_1 on the_table (num_found)
select avg(num_found) from the_table
-> Index Scan(OBJECT:([midata].[dbo].[THE_TABLE].[x_1])

(I'm not sure what Oracle does - have to re-install it first ...)


@Scott:
> Yes, you're expecting an MVCC database to behave like a row locking
> database.

hmmmm...
So, it seems that PG is not soooo well suited for a datawarehouse and/or performing extensive
statistics/calculations/reportingson large tables, is it? 

Greetings Harald

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Query performance
Следующее
От: Dennis Bjorklund
Дата:
Сообщение: Re: no index-usage on aggregate-functions?