Re: anyway to optimize this query?
Posted in 1999
>hi all:
> I have a 16 gig database, each record is contains 50 fields.
> I am running a query like this:
>
> select f1,f2....f15, sum(f40),sum(f41),sum(f42), sumf(43)
> group by f1,f2...f15>
> as you see, i have to group about 15 fields and sum 4 other fields
>based on that group.
> now, it took me about 12 hours to run that query, my questions are:
>
> 1. is that normal speed or too slow?
> 2. if too slow, what are the suggestions to make it faster?
This isn't really anything like enough information to make an informed
comment, but that has never stopped me in the past. :-)
1. UPDATE STATISTICS
2. Indexes
3. Pre-aggregate the data
4. Tune the database server.
If you need more help, please provide more details. Specifically: how
many rows in the table, table and index structures for the table,
onconfig file, etc.
HTH.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com