I have one large table of 150,000 records that I'll get a phone # from.
I have another table that has the phone # and 15 columns that have peg counts in them that i want to sum. This table has 175 million records.
phone# sumPeakMinutes sum OffPeakMinutes, etc....
I need to get 2 years of data so it is alot of info coming back.
What is the best way to go about this?
1. select phoneNbr, sum(PeakMinutes), sum(OffPeakMinutes), etc...
2. Create temp table of 1st table that is the exact same as 1st table, which has phone#.
then create temp table of SummaryData, and it would drop from 175 milion records to 125 million records, then do join between these 2 tables and then do one update statement at a time to get each sum(data) and then spit out results
3. do something else? what?
I do have indexes on these tables where appropriate, its just taking forever, which i do understand we are dealing with alot of records.