Cost of max
От | Stefano Bargioni |
---|---|
Тема | Cost of max |
Дата | |
Msg-id | 3A4AFF6E.F2F45D30@usc.urbe.it обсуждение исходный текст |
Список | pgsql-general |
I build a little test table with columns id serial, a text, b text. Why the cost of max(id) is made as a seq scan, as isfor count(id)? This is a problem with very large tables. IMHO, select max(id) could be done using the index prova_id_key. Your opinion? TIA. Stefano mydb=> explain select max(id) from prova; NOTICE: QUERY PLAN: Aggregate (cost=43.00 rows=1000 width=4) -> Seq Scan on prova (cost=43.00 rows=1000 width=4) EXPLAIN mydb=> explain select count(id) from prova; NOTICE: QUERY PLAN: Aggregate (cost=43.00 rows=1000 width=4) -> Seq Scan on prova (cost=43.00 rows=1000 width=4) -- Dott. Stefano Bargioni Biblioteca della Pontificia Universita' della Santa Croce - Roma <mailto:bargioni@usc.urbe.it> <http://www.usc.urbe.it> Personal web page: <http://www.usc.urbe.it/html/php.script?bargioni> --- "Si apud bibliothecam hortulum habes, nihil deerit" (Cicerone) ---
В списке pgsql-general по дате отправления: