I have a virtual table (call it table_a) that represents a query that is querying other tables with raw and aggregate reflections. If I go into EDIT original SQL for table_a and add:
SELECT COUNT(*) FROM (
rest of table_a query
Then it uses the reflections and the query runs quickly. However if I simply run:
SELECT COUNT(*) FROM table_a
then the reflections are not used.
This behavior is totally unexpected.