当表orbeon_form_data中的记录增长到2600+行时,我们开始对Persistent API /search/$app/$form
的响应速度慢,返回结果需要24000+ ms。
搜索API和POST BODY示例如下: http://localhost/orbeon/fr/service/persistence/search/MYAPP/MYFORM
<search>
<query search-field="true" match="exact" path="section-search/myKey">myValue</query>
<page-size>10</page-size>
<page-number>1</page-number>
<lang>en</lang>
</search>
我们正在使用PostgreSQL,并通过将官方postgresql-2016_2.sql
与oracle-2016_2.sql
进行比较,Oracle版本包含用于创建索引的额外语句。
缺失的索引可能是响应缓慢的原因吗?
以下是部分日志:
2016-09-30 14:22:58,846 INFO ProcessorService - / fr / service / persistence / form / MYAPP / MYFORM - 时间:64
2016-09-30 14:22:58,846 INFO生命周期 - 事件:{“request”:“5624”,“session”: “FBBA97DDA0A35BA878C01250536E791F”,“来源”:“服务”, “message”:“end:handle”,“time”:“64 ms”}
2016-09-30 14:23:23,443 INFO ProcessorService - / fr / service / postgresql / search / MYAPP / MYFORM - 时间:24670
2016年9月30日 14:23:23,444 INFO生命周期 - 事件:{“request”:“5623”,“session”: “FBBA97DDA0A35BA878C01250536E791F”,“来源”:“服务”, “message”:“end:handle”,“time”:“24,671 ms”}
SELECT COUNT(*)
FROM (SELECT c.data_id,
c.document_id,
c.draft,
c.created,
c.last_modified_time,
c.last_modified_by,
c.username,
c.groupname,
ROW_NUMBER() OVER (ORDER BY c.last_modified_time DESC) ROW_NUMBER
FROM orbeon_i_current c,
orbeon_form_data d
WHERE c.app = 'MYAPP'
AND c.form = 'MYFORM'
AND c.draft = 'N'
AND d.id = c.data_id
AND xml::text ilike ?) a;
SELECT c.*,
t.control,
t.pos,
t.val
FROM (SELECT c.data_id,
c.document_id,
c.draft,
c.created,
c.last_modified_time,
c.last_modified_by,
c.username,
c.groupname,
ROW_NUMBER() OVER (ORDER BY c.last_modified_time DESC) ROW_NUMBER
FROM orbeon_i_current c,
orbeon_form_data d
WHERE c.app = 'MYAPP'
AND c.form = 'MYFORM'
AND c.draft = 'N'
AND d.id = c.data_id
AND xml::text ilike ?) c
LEFT JOIN orbeon_i_control_text t ON c.data_id = t.data_id
WHERE ROW_NUMBER BETWEEN 1 AND 10 ;