I have some very simple queries that occasionally run very slowly.
The table viewed_sites has about 10 - 20 rows.
Running EXPLAIN ANALYZE always gives a runtime of less than 3 milliseconds.
When the query is run automatically (every 10 seconds) it occasionally takes over a second to run.
INSERT INTO ga.viewed_sites (site_id) VALUES ('gop2')
CREATE TABLE viewed_sites ( site_id character varying(4) NOT NULL, last_viewed timestamp with time zone DEFAULT now() NOT NULL );
The (occasional) log result:
2010-05-24 15:47:55 UTC LOG: duration: 1044.632 ms statement: INSERT INTO ga.viewed_sites (site_id) VALUES ('gop2')
It's a horribly vague question, but what could be causing this? I suppose it comes down to CPU, RAM, HDD or some combination of the above.
Postgresql 8.3, Ubuntu 8.04
Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66GHz
2 GiB RAM