I have not tried that solution but what about the creation of a temp table and a join between the temp table and the rest of the tables in your query? You could create a temp table like that:
create query_temp_table (
query_id integer primary key,
query_value integer/varchar
);
insert the 1000 values into query_temp_table using a certain query_id for each run. this would make it unnecessary to create/drop tables, you could just get a new query_id from a sequence and wrap the insert in a transaction.