I am doing a simple SELECT on a fairly complex view:
select * from balances where day = date'2011-08-15';
The results are correct, and they arrive in about 3 seconds. However, immediately repeating the exact same query takes about 3 minutes!
Using a different SELECT list and/or WHERE clause gives a quick result, but only once; repeating
any past query triggers the big slowdown.
Doing ANALYZE TABLE on any of the tables involved in the view seems to reset things and the queries become fast again, but still only once for each specific query.
This view worked fine on 9i and has only started doing this since we moved to 11g.
Weird, eh?