Pregunta

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)?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top