Archives of the TeradataForum
Message Posted: Wed, 08 Feb 2006 @ 17:30:39 GMT
Seems there's a known issue with PPI not being used when dates in a BETWEEN are manipulated with date arithmetic or the dates come from another table. Anyone have a way to force the optimizer to use the PPI under these conditions? I don't want to hard code dates in my query.
For a simple example I have some SQL where I create a single row volatile table with a dynamically determined beg_date and end_date which is duplicated on all the amps then product joined to the large table but the PPI is not being used and the full table scan is very expensive.
I hear this won't be fixed till maybe V2R7...any suggestions for the meantime?
These do not use the PPI and do a full table scan:
select * from really_big_table, my_dates WHERE table_date BETWEEN beg_of_month and end_of_month; select * from really_big_table WHERE table_date BETWEEN date-10 and date;
This does use the PPI:
select * from really_big_table WHERE table_date BETWEEN '2006-01-01' and '2006-01-31';
Table my_date has two columns and one row:
beg_of_month end_of_month '2006-01-01' '2006-01-31'
Table really_big_table has 4+ billion rows.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|