Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Partitioned Views

Status
Not open for further replies.

andyrobins

Technical User
Aug 27, 2003
9
GB
I have come across a rather odd problem with partitioned views and was hoping that someone could shed some light on it.

If you have, for example, 4 base tables for each quarter's sales data and these are partitioned using a datetime field that is part of the primary key and using the constraint >='2005-01-01' and < '2005-04-01' then some weird things happen with the execution plans.
If you execute
select * from accounts
where act_timestamp >= '2005-01-02 00:00:00.000' and act_timestamp <= '2005-01-03 12:31:00.000'
you get access to all tables in the partition. (this is proved by the actual execution plan and the statistics IO/TIME options)
But, if you execute
select * from accounts
where act_timestamp IN ('2005-01-02 00:00:00.000' , '2005-01-03 12:31:00.000')
then it will work out which subtable it needs and provide a much more sensible plan.

Is there some limit to using ranges or logical operators within a partitioned query, or am I just being a bit of a fool and doing something wrong? (I suspect the latter!! :))

Thanks in advance

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top