Query page: Statement 1 has more than 10 times better performance, but it is hard to understand because it has more than one top keyword !!!!
1. Primary Key r_object_id within 1 s
Select Top 100 * from (
Select All Doc. r_object_id "objid", Doc. name, Doc. number, Doc. cuid, Doc. r_creation_date, Doc. security, Doc. bordline, Doc. twicedline, Doc. dline, Doc. keynum, Doc. creator_name,
Doc. security_name, Doc. dline_name, Doc. PID, Doc. modifier_name, Doc. tblcount, Doc. r_modify_date, Doc. prjdefid, Doc. voldefid, Doc. tabledefid, Doc. relation_id,
Doc. r_object_type "r_object_type", Doc. bcode "bcode", Doc. copycount, Doc. securityapply, Doc. pgholtime, Doc. Done, Doc. disciplineid, Doc. disciplineid_name,
Tabdef. fieldp2830b1886150468j, tabdef. fieldb7727l1886150454q, tabdef. Digest, tabdef. fieldt3104x504621623d, tabdef. fieldf3763y504621609s, tabdef. Large,
Tabdef. Digest, tabdef. Digest, tabdef. fieldk5874q1350775954t, tabdef. fieldb2206h1350775945a, tabdef. fieldf4308a1350775949v, tabdef. recid,
Cast (row_number () over (order by Doc. r_object_id ASC) as INT) as dm_rnum
From ps_fld_doctree_document_sp Doc
Left Outer Join tabledef00054a9a80001e7d_sp tabdef on (Doc. r_object_id = tabdef. recid) Where (Doc. keynum like n 'aaaaaaaaaaaaaaa % 'and (Doc. isdel = 0) or (Doc. isdel = 1 )))
And (Doc. I _has_folder = 1 and Doc. I _is_deleted = 0)
) Dm_inline_view_1
Where dm_rnum> = 101 and dm_rnum <= 200 order by 1 ASC
2. the query time is within 10 s.
Select * from (
Select All Doc. r_object_id "objid", Doc. name, Doc. number, Doc. cuid, Doc. r_creation_date, Doc. security, Doc. bordline, Doc. twicedline, Doc. dline, Doc. keynum, Doc. creator_name,
Doc. security_name, Doc. dline_name, Doc. PID, Doc. modifier_name, Doc. tblcount, Doc. r_modify_date, Doc. prjdefid, Doc. voldefid, Doc. tabledefid, Doc. relation_id,
Doc. r_object_type "r_object_type", Doc. bcode "bcode", Doc. copycount, Doc. securityapply, Doc. pgholtime, Doc. Done, Doc. disciplineid, Doc. disciplineid_name,
Tabdef. fieldp2830b1886150468j, tabdef. fieldb7727l1886150454q, tabdef. Digest, tabdef. fieldt3104x504621623d, tabdef. fieldf3763y504621609s, tabdef. Large,
Tabdef. Digest, tabdef. Digest, tabdef. fieldk5874q1350775954t, tabdef. fieldb2206h1350775945a, tabdef. fieldf4308a1350775949v, tabdef. recid,
Cast (row_number () over (order by Doc. r_object_id ASC) as INT) as dm_rnum
From ps_fld_doctree_document_sp Doc
Left Outer Join tabledef00054a9a80001e7d_sp tabdef on (Doc. r_object_id = tabdef. recid) Where (Doc. keynum like n 'aaaaaaaaaaaaaaa % 'and (Doc. isdel = 0) or (Doc. isdel = 1 )))
And (Doc. I _has_folder = 1 and Doc. I _is_deleted = 0)
) Dm_inline_view_1
Where dm_rnum> = 101 and dm_rnum <= 200 order by 1 ASC