Query plan / table partitioning

This is a discussion on Query plan / table partitioning within the ibm-db2 forums in Other Databases category; I have set up a test table with range partitioning. The partitions are by date (recdate): 1) Pre-2004 2) 2004 3) 2005 4) 2006 5) 2007 6) 2008 When executing the query: select * from analysis_data where year(recdate) = 2006, I would expect that the query plan would utilize only the partition with 2006 data. However, it seems to do a TBSCAN across the entire table. There are no indexes setup on the table. DB2 Version 9.1 fp 4a...

Go Back   Database Forum > Other Databases > ibm-db2

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 06:07 PM
Default Query plan / table partitioning

I have set up a test table with range partitioning. The partitions
are by date (recdate):
1) Pre-2004
2) 2004
3) 2005
4) 2006
5) 2007
6) 2008

When executing the query: select * from analysis_data where
year(recdate) = 2006, I would expect that the query plan would utilize
only the partition with 2006 data. However, it seems to do a TBSCAN
across the entire table.

There are no indexes setup on the table. DB2 Version 9.1 fp 4a
Reply With Quote
  #2  
Old 08-30-2008, 05:15 AM
Default Re: Query plan / table partitioning

On Aug 27, 11:07*pm, Justin wrote:
> I have set up a test table with range partitioning. *The partitions
> are by date (recdate):
> 1) Pre-2004
> 2) 2004
> 3) 2005
> 4) 2006
> 5) 2007
> 6) 2008
>
> When executing the query: select * from analysis_data where
> year(recdate) = 2006, I would expect that the query plan would utilize
> only the partition with 2006 data. *However, it seems to do a TBSCAN
> across the entire table.
>
> There are no indexes setup on the table. *DB2 Version 9.1 fp 4a


Don't know about this, but just an idea: A one-dimensional MDC would
cost almost no space and stop DB2 from scanning the whole table.
Reply With Quote
  #3  
Old 09-08-2008, 01:23 PM
Default Re: Query plan / table partitioning

On Aug 27, 2:07*pm, Justin wrote:
> I have set up a test table with range partitioning. *The partitions
> are by date (recdate):

Did you partition by date (i.e., date between '2005-01-01' and
'2005-12-31' or by YEAR(date) = 2005?
-Chris
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 12:59 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.