Re: BETWEEN a DATE and a hard place
Thanks for all your help. I am partitioning by week of year, totaling 53, rather than the 100+ I was originally going to do. I am using RANGE partitions rather than KEY.
As a token of my appreciation, here's a little python program that generates evenly distributed RANGE PARTITION values (INT only). It is somewhat general purpose and saved me a visit to the doctor for carpal tunnel syndrome.
I'm sure it'll prove absolutely useless to you but it makes me feel better about being so difficult :).
import optparse
if __name__ == '__main__':
parser = optparse.OptionParser(usage='%prog [options]')
parser.set_defaults(minVal=1, maxVal=53, count=53)
parser.add_option('-i', '--min', dest='minVal', action='store', type='int', help='min value (default: %default)')
parser.add_option('-a', '--max', dest='maxVal', action='store', type='int', help='max value (default: %default)')
parser.add_option('-c', '--count', dest='count', action='store', type='int', help='partition count (default: %default)')
options, junk = parser.parse_args()
part = 0
incr = float (options.maxVal - options.minVal + 1) / float(options.count)
while part < options.count:
val = int((part+1)*incr) + options.minVal
print ("PARTITION p"+str(part)+" VALUES LESS THAN ("+str(val)+"),")
part+=1