Frage

I have a rather large table which I need to query for a reporting application. Most of the time users will be interested in last 7 days worth of data but they want to be able to query the older (archive data) every now and then. Since they want everything to be blazing fast for recent data but don't mind the wait for archive records, my guess is I should be fine with a partitioned view (data) and two tables (data_current and data_archive).

I know how to created the initial tables (constraints and all) and the view. How do I go about automating the daily maintenance (move older data from_current to _archive)?

War es hilfreich?

Lösung

You should use sliding window pattern. Write a stored procedure to swap partitions between tables and use a job to schedule execution.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top