oracle11g - Oracle SELECT * FROM LARGE_TABLE - takes minutes to respond -
so have simple table 5 or columns, 1 of clob containing json data.
i running
select * big_table
select * big_table rownum < 2
select * big_table rownum = 1
select * big_table id=x
i expect fractionally intelligent relational database return data immediately. not imposing order by/group clauses, why not return data , when find it?
of forms of select statements above, 4. returned in sub-second manner. unexpected 1-3 returning between 1 , 10 minutes before query shows responses in sql developer. sql developer has standard sql array fetch size of 50 (jdbc fetch size of 50 rows) @ minimum, taking 1-10 minutes return 50 rows simple table no joins on super high-performance rac cluster backed fancy 4-tiered emc disk subsystem.
explain plans show table scan. fine, why should wait 1-10 minutes results rownum in clause?
what going on here?
ok - found issue. rownum not operate thought did , in code above never stops full table scan.
this because:
rownum assigned during predicate operation (where clause evaluation) , incremented afterwards, i.e.: row makes result set , gets rownum assigned.
in order filter rownum need have exist, ...
select * (select * big_table) rownum < 1
in effect means there no way filter out top 5 rows table without having first selected entire table if no other filter criteria involved.
i solved problem this...
select * (select * big_table date_col between :date1 , :date2) rownum < :x;
Comments
Post a Comment