This is a follow-up to an earlier question. I have a SQL Server 2008 R2 Standard server, that holds a single database, which itself has almost nothing except a large table.
The table is 100+ million rows (35 columns) and growing at around 250,000 rows per day. We need all the data to be "online", and most of the columns need to be searchable in some fashion. The vast majority of activity on the table is reading; apart from the new data being INSERT
ed during the day, there's no need to change anything.
Users perform a range of queries on the table, ranging from simple look-up-a-record requests to pulling tens of thousands of rows based on a range of criteria. We only have limited control on the queries that are run, and performance is starting to suffer, even with indexing.
A big part of the problem is disk I/O, which we're addressing by retrofitting a SSD-based array. As all database files will be on this new array, the consensus is that having multiple database files won't make any difference, but that splitting the table up into separate tables might be the way to go.
I'm now puzzling over what would be the best approach to this. Two ideas that I'm debating with myself:
Split the table into "tiers"
- A table containing the last week's data, which is the one being
INSERT
ed into each day - Next table containing from last week back to 3 months previous
- Next table containing from 3 months to 6 months
- Next table containing anything older than 6 months
I'd then "shuffle" the data down the tiers overnight (the database is only accessed 8am-10pm, so I have a window overnight to process data).
- A table containing the last week's data, which is the one being
Create tables for data ranges
- Create a table for a data range - say per quarter. I'd then have
the data
INSERT
ing into the table 2Q2013, and then trip over to 3Q2013, 4Q2014 etc ...
I could use filegroups to make older tables "read only" if this would improve performance.
- Create a table for a data range - say per quarter. I'd then have
the data
Option 1 is the easiest for me to implement, but I'm not sure if this is a completely mad idea. Option 2 is a more work to implement and maintain, but if it's "best practice" for this kind of problem that it's the way I'll go.
Any and all advice or alternative ideas would be gratefully received - I'm away that these kinds of problems are best solved at design-time.