Forwarding to the list......
---------------------- Forwarded by Wesley Sheldahl/Lex/Lexmark on 11/19/2001
05:16 PM ---------------------------
Brian Avis <brian.avis%searhc.org@interlock.lexmark.com> on 11/19/2001 05:02:39
PM
To: "Wesley_Sheldahl/Lex/Lexmark.LEXMARK"@sweeper.lex.lexmark.com
cc: (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject: Re: [GENERAL] Need more speed from this.
Okay then. :)
EXPLAIN SELECT AVG(data) FROM system_data
WHERE date BETWEEN CAST('2000-01-01' AS DATE)
AND CAST ('2000-01-31' AS DATE)
AND
server_id = 26
AND
data_type_id = 8;
Gives me this.
NOTICE: QUERY PLAN:
Aggregate (cost=17296.84..17296.84 rows=1 width=8)
-> Index Scan using data_type_id_idx on system_data
(cost=0.00..17296.84 rows=1 width=8)
EXPLAIN
The table grows once a day via a perl script.
I will add an index to the date column and see what happens.
wsheldah@lexmark.com wrote:
>
>Standard questions:
>Have you run VACUUM ANALYZE recently?
>
>Could you send the results of running EXPLAIN on the query in question?
>
>Do the statistics from the EXPLAIN look reasonably accurate?
>
>How about adding an index to the date column?
>
>Is the table growing interactively, or via a once-a-day batch?
>
>HTH,
>
>Wes Sheldahl
>
>
>
>
>
>
>
--
Brian Avis
SEARHC Medical Clinic
Juneau, AK 99801
(907) 463-4049
cd /pub
more beer