Blog Post

Partitioning Gotcha

,

Well, it got me at least! Not long ago someone asked me about partitioned views and as I'm apt to do, I just did a demo on the fly. I built two tables, added the check constraints, then union all'd them together in a view. But the query showed both tables being queried regardless of what I put in the where clause - what did I do wrong?

Had to step away from it for a minute, came back to figuring it had to be the contraints. I had implemented emailaddress like '[a-m]%' and emailaddress like '[n-z]%', and the optimizer just doesn't find those useful! They work as constraints, they just don't help the query plan. Changing to emailaddress < 'N' solved the problem. Not intuitive, but I guess not the end of the world either. But it's no fun when the live unplanned demo doesn't work!

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating