migre 22 millones de registros en una tabla en PostgreSQL 8.2
ddds, numeros..etc ..ddds del tipo: character varying(3)
que quando ejecuto:
-- sin indices
-- Executing query:
SELECT ddd, count(ddd) AS cantidad FROM tabla GROUP BY 1 ORDER BY 1
-- Executing query:
SELECT ddd, count(ddd) AS cantidad FROM tabla GROUP BY 1 ORDER BY 1
Total query runtime: 432421 ms.
65 rows retrieved.
65 rows retrieved.
-- Executing query:
CREATE INDEX tabla_idx_ddd ON tabla (ddd)
CREATE INDEX tabla_idx_ddd ON tabla (ddd)
Query returned successfully with no result in 496755 ms.
nuevamente ahora ya con indice...
-- Executing query:
SELECT ddd, count(ddd) AS cantidad FROM tabla GROUP BY 1 ORDER BY 1
SELECT ddd, count(ddd) AS cantidad FROM tabla GROUP BY 1 ORDER BY 1
Total query runtime: 404579 ms.
65 rows retrieved.
65 rows retrieved.
deberia ser mucho!!!! mas rapido.. no???
agradezco todas las sugerencias
Abrazos a todos
No comments:
Post a Comment