关于Sql语句的执行速度问题?
create or replace function GetKindName(iSequence in number) return Varchar2
deterministic
is
type MyCurType is ref cursor;
MyCur MyCurtype;
a Varchar2(20);
SqlStr String(3000);
begin
SqlStr:='SELECT sKindName FROM Kind Where iSequence='||iSequence;
open MyCur for SqlStr;
FETCH MyCur INTO a;
RETURN a;
end GetKindName;
这自定义函数是返回一个类型的中文名称
第一条sql语句:select * from (select table_a.*,rownum as my_rownum from (Select sPersonName,iPersonCount, From xrecord ) table_a where rownum<=40560) where my_rownum>=40546
第二条sql语句:select * from (select table_a.*,rownum as my_rownum from (Select sPersonName,iPersonCount,GetKindName(iKind) From xrecord ) table_a where rownum<=40560) where my_rownum>=40546
为何增加了GetKindName(iKind)语句后,查询速度变得奇慢,而且 rownum越大,变得越慢,有什么解决的方法。此语句用左分页使用