From: | Gavin Sherry <swm(at)alcove(dot)com(dot)au> |
---|---|
To: | Roger Hand <RHand(at)kailea(dot)com> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Query plan looks OK, but slow I/O - settings advice? |
Date: | 2005-08-19 07:17:45 |
Message-ID: | Pine.LNX.4.58.0508191710450.31045@linuxworld.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
The query plan does *not* look okay.
> electric=# EXPLAIN ANALYZE
> electric-# SELECT datavalue, logfielddatatype, timestamp FROM logdata_recent
> electric-# WHERE (logfielddatatype = 70 OR logfielddatatype = 71 OR logfielddatatype = 69)
> electric-# AND graphtargetlog = 1327
> electric-# AND timestamp >= 1123052400 AND timestamp <= 1123138800
> electric-# ORDER BY timestamp;
> QUERY PLAN
> --------------------------------------------------
> Sort (cost=82.48..82.50 rows=6 width=14) (actual time=60208.968..60211.232 rows=2625 loops=1)
> Sort Key: public.logdata_recent."timestamp"
> -> Result (cost=0.00..82.41 rows=6 width=14) (actual time=52.483..60200.868 rows=2625 loops=1)
> -> Append (cost=0.00..82.41 rows=6 width=14) (actual time=52.476..60189.929 rows=2625 loops=1)
> -> Seq Scan on logdata_recent (cost=0.00..46.25 rows=1 width=14) (actual time=0.003..0.003 rows=0 loops=1)
> Filter: (((logfielddatatype = 70) OR (logfielddatatype = 71) OR (logfielddatatype = 69)) AND (graphtargetlog = 1327) AND ("timestamp" >= 1123052400) AND ("timestamp" <= 1123138800))
> -> Index Scan using logdata_recent_1123085306_ix_t_fld_gtl, logdata_recent_1123085306_ix_t_fld_gtl, logdata_recent_1123085306_ix_t_fld_gtl on logdata_recent_stale logdata_recent (cost=0.00..18.08 rows=3 width=14) (actual time=52.465..60181.624 rows=2625 loops=1)
Notice here that expected rows is 3, but actual rows is a hell of a lot
higher. Try increasing stats collections for the columns on which
logdata_recent_1123085306_ix_t_fld_gtl is declared.
Also, the actual index scan is taking a long time. How recently have you
vacuum full'd?
Thanks,
Gavin
From | Date | Subject | |
---|---|---|---|
Next Message | Roger Hand | 2005-08-19 07:35:23 | Re: Query plan looks OK, but slow I/O - settings advice? |
Previous Message | Jeffrey W. Baker | 2005-08-19 06:55:35 | Re: Query plan looks OK, but slow I/O - settings advice? |