I have a table that is partitioned on a date column, with a default partition. In our deletion process, we drop partitions that are older than the retention date and then delete records that are older than the retention date in order to catch any that are in the default.
The delete statement is not using partition elimination.
I select the date from a table into a date variable, then use that in a query:
declare v_retention_date date;
select retention_date
from schemaname.parametertable
into v_retention_date;
select count(*)
into v_row_count
from schemaname.tablename
where pdate < v_retention_date;
Other queries are doing partition elimination, those are passed in as text parameters to the procedure. Why might this query not do so?