This solution is also meant to be a design pattern that we are going to roll-out to a dozen different logging tables that we need to transform raw data into something that can be used by the BI team.
In the future, I will likely spin off some posts to detail the logging elements and the Tableau tools we use to keep an eye on everything and minimize our response time when things wiggle (spiral) out of control.
With that said, this post is all about creating a very clean Sliding Window Partition and creating the tools needed to monitor a daily process of "Swapping In" new data and "Swapping Out" old data while maximizing the availability of the data assets and minimizing/eliminating waits on the data structures.
The solution is stratified into several different realms:
- Global Setup: Create a schema for our partition objects, create views to query how the partition is structured and where data is being stored across the partitions.
- Process Setup: Define partition function and scheme for a particular Logging table.
- Data Load (Optional for testing): Widget to load data into the partition and stage tables to help valid the switching process
- Process Execution: scripts to Switch In and Switch Out.
- Reset and Test Again: Scrap the non-global pieces and re-run for quicker testing
- Troubleshooting and Monitoring: Scripts to look at the partitions, stage tables, and other helper tools.
NOTE: This post and supporting scripts were published when I was ready to migrate from my DEV environment into a staging/QA environment and test with real production data volume. I made a handful of mods and enhancements before I actually went to production...but those changes are geared towards a real world implementation and don't match up with the dummy database used in the initial scripts shared with this post. I'm more than happy to share the changes that we put in place as we matured the process, but they are not plug and play for a dev environment.
Testing is almost complete and we're are set to deploy into production later this week.
Get your partition on!
Marc
No comments:
Post a Comment