Postgresql count+sort performance
- by invictus
I have built a small inventory system using postgresql and psycopg2. Everything works great, except, when I want to create aggregated summaries/reports of the content, I get really bad performance due to count()'ing and sorting.
The DB schema is as follows:
CREATE TABLE hosts
(
id SERIAL PRIMARY KEY,
name VARCHAR(255)
);
CREATE…