Kevin Grittner-5 wrote > What is the longest you have let it run, in hours or minutes? I let it run for about 10 minutes and killed it. Kevin Grittner-5 wrote > By the way, IMMUTABLE has to be wrong here, since the results > depend on the state of the database. STABLE is likely the right > designation. The data will not change unless I do a reload of the data set manually. In that case, is IMMUTABLE wrong? Here is the EXPLAIN (no analyze) explain select distinct geoip_city(src_ip) , src_ip from alert where timestamp>=1378512000 and timestamp < 1378598400; QUERY PLAN --------------------------------------------------------------------------------------------- Unique (cost=3815.75..3894.61 rows=39 width=8) -> Sort (cost=3815.75..3842.04 rows=10515 width=8) Sort Key: (geoip_city(src_ip)), src_ip -> Index Scan using idx_alert_ts on alert (cost=0.29..3113.34 rows=10515 width=8) Index Cond: (("timestamp" >= 1378512000) AND ("timestamp" < 1378598400)) (5 rows) -- View this message in context: http://postgresql.1045698.n5.nabble.com/Query-CPU-issue-tp5771421p5771552.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general