Have a large number of tables Am with a big ring, m - some index. I'm making this request:
SELECT * FROM A1, A2, ... An WHERE ROWNUM < 2;
And my request is up. Logically, the bd should choose the first lines from each table, collect them in one, assign one and remove them. Why is it taking too long?
The logic of the database looks different. The request contains a decarto work, all the lines of all the tables are multiplied by each other because the conditions of the tables are not specified in the section where/join. Once the lines are combined in all possible combinations, the first line will be taken. That's why it took so long. The problem can be solved by several methods, the simplest, to replace the listing of the sub-request tables:
select * from (select * from a1 where rownum < 2), (select * from a2 where rownum < 2)...