Is there any existing (non-proprietary) solution how to mirror current day data onto separate disk with minimum delay (under second), so that I can use smaller, non redundant but more expensive disk for high rate of reads? (specifically for SQL Server 2012)
More background:
- We have a transnational DB that needs to be redundant, there are few dozen thousands of new rows daily (handled without any problem); but main perf impact on DB is from reads that happen few times per second. Reads need to have fresh data (at max 1 second old), but they are only interested in current day data. All writes need to go to disk array with also very small delay.
- I can use small fast but non-redundant SSD disk to optimize reads.
There are few proprietary options - e.g. send each update to two separate nonrelated DBs - one slower and redundant; and other faster for reading.
However is there any existing solution for this - how to mirror all inserts to secondary DB (and purge each midnight)?
You can use an indexed view to store the current days data on a separate dataspace. You'll have to build a new view each day so you may want to use a synonym to do the actual switching so as to avoid locks on insert while creating the view. Make sure you end date the filter on the column. This is how i would do it using to agent jobs:
You don't mention updates so a clustered index on date shouldn't fragment enough to worry about. You may want to set the fillfactor on the index to 100 which will reduce the size on disk by 20 % over the default. This will help further reduce the IO hit.