Query optimization

Поиск
Список
Период
Сортировка
Искать

Query optimization

От:
Eduardo Vázquez Rodríguez<evazquez@insys-corp.com.mx>
Дата:
Hello Postgres users

I have a question regarding the optimization of a query, I have a table that
contains approximately 14 millions of rows and I want to retrieve the
following information;

SELECT username, sum(bytes_used) AS TOTAL
FROM BIGTABLE 
GROUP BY username
LIMIT 100;

Username is an Index varchar
bytes_used is float8 type

But it is really slow, it has been running for 1 hour and it simply does not
ends.

While the query is running, the table is been updating with more rows.

How can I improve it?

Thanks in advanced
FAQ