optimizer question

Поиск
Список
Период
Сортировка
От Reinoud van Leeuwen
Тема optimizer question
Дата
Msg-id 23710.194.109.0.126.1001508794.squirrel@webmail.xs4all.nl
обсуждение исходный текст
Ответы Re: optimizer question
Список pgsql-hackers
Hi, 

I have a table that contains almost 8 milion rows. The primary key is a 
sequence, so the index should have a good distribution. Why does the 
optimizer refuse to use the index for getting the maximum value?
(even after a vacuum analyze of the table)

radius=# explain select max(radiuspk) from radius ;
NOTICE:  QUERY PLAN:

Aggregate  (cost=257484.70..257484.70 rows=1 width=8) ->  Seq Scan on radius  (cost=0.00..237616.76 rows=7947176
width=8)


Table and key info:

Did not find any relation named "radius_pk".
radius=# \d radius                                        Table "radius"     Attribute      |           Type
|            Modifier   
 
---------------------+--------------------------+---------------------------sessionid           | character varying(30)
  | not nullusername            | character varying(30)    | not nullnas_ip              | character varying(50)    |
notnulllogfileid           | integer                  |login_ip_host       | character varying(50)    | not
nullframed_ip_address  | character varying(50)    |file_timestamp      | timestamp with time zone | not
nullcorrected_timestamp| timestamp with time zone | not nullacct_status_type    | smallint                 | not
nullbytesin            | bigint                   |bytesout            | bigint                   |handled
|boolean                  | not null default 'f'sessionhandled      | boolean                  | not null default
'f'radiuspk           | bigint                   | not null default nextval
 
('radiuspk_seq'::text)
Indices: pk_radius,        radius_us

radius=# \d pk_radiusIndex "pk_radius"Attribute |  Type
-----------+--------radiuspk  | bigint
unique btree (primary key)




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

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: Unicode combining characters
Следующее
От: Thomas Lockhart
Дата:
Сообщение: iscacheable for date/time?