[PERFORM] select max/count(id) not using index

2003-12-22 Thread Ryszard Lach
Hi. I have a table with 24k records and btree index on column 'id'. Is this normal, that 'select max(id)' or 'select count(id)' causes a sequential scan? It takes over 24 seconds (on a pretty fast machine): = explain ANALYZE select max(id) from ogloszenia; QUERY PLAN

Re: [PERFORM] select max/count(id) not using index

2003-12-22 Thread Christopher Kings-Lynne
I have a table with 24k records and btree index on column 'id'. Is this normal, that 'select max(id)' or 'select count(id)' causes a sequential scan? It takes over 24 seconds (on a pretty fast machine): = explain ANALYZE select max(id) from ogloszenia; Yes, it is. It is a known issue with

Re: [PERFORM] select max/count(id) not using index

2003-12-22 Thread Pavel Stehule
Hello It is normal behavior PostgreSQL. Use SELECT id FROM tabulka ORDER BY id DESC LIMIT 1; regards Pavel On Mon, 22 Dec 2003, Ryszard Lach wrote: Hi. I have a table with 24k records and btree index on column 'id'. Is this normal, that 'select max(id)' or 'select count(id)' causes a

Re: [PERFORM] select max/count(id) not using index

2003-12-22 Thread Evil Azrael
Guten Tag Ryszard Lach, Am Montag, 22. Dezember 2003 um 11:39 schrieben Sie: RL Hi. RL I have a table with 24k records and btree index on column 'id'. Is this RL normal, that 'select max(id)' or 'select count(id)' causes a sequential RL scan? It takes over 24 seconds (on a pretty fast machine):