診断

Confluence では、クエリが lower() 関数を使用するため、タイトルでページを取得する際にパフォーマンス上の問題が発生することがあります。クエリはたとえば次のようなものになります。

select * from CONTENT where lower(TITLE) = :title and SPACEID = :spaceid

データベース プロファイリングでは、実行に時間がかかる次のようなクエリが表示される場合があります(部分的に太字にしてあります)。 

select ... from CONTENT page0_, SPACES space1_
where page0_.CONTENTTYPE='PAGE'
and ((lower(space1_.SPACEKEY)= @P0 and page0_.SPACEID=space1_.SPACEID)
and(lower(page0_.TITLE)= @P1 )
and(page0_.PREVVER is null )and(page0_.CONTENT_STATUS='current' ))

Typically, databases don't use indexes when you use a function in a where clause; they do a table scan instead. This makes the performance of this query not ideal (CONF-11577).

一般的な解決策

On many databases (e.g. Oracle, PostgreSQL), it is possible to create the index using the normal "create index" syntax, just using the function instead of the column name.

create index CONFTITLE_LOWER on CONTENT(lower(TITLE));

ソース

SQL Server

SQL Server では、データベースのテーブルに計算列を追加して、その列にインデックスを追加できます。

alter table CONTENT add TITLE_LOWER as lower(TITLE);
create index CONFTITLE_LOWER on CONTENT(TITLE_LOWER);

ソース

MySQL

It is not currently possible to create a lowercase index on MySQL.

ソース:

大文字と小文字を区別しない照合を使用する MySQL データベースの回避策

Please check whether your MySQL DB has been set to use case-sensitive or case-insensitive collation.
The queries to check whether your DB is set to be case-insensitive are:

フィールド = 'title' のコンテンツから列全体を表示する
field = 'spacekey' のスペースから列全体を表示する

If the collation_name is returned as <encoding>_ci, the ci indicates case insensitive collation.
If the DB has been set to use case-insensitive collation, you can try removing lower from the following queries, in your ContentEntityObject.hbm.xml file residing in your <Confluence-Install>/confluence/web-inf/lib/confluence-2.x.x.jar/com/atlassian/confluence/core/:

<query name="confluence.page_findLatestBySpaceKeyTitle"><![CDATA[
	from Page page
	where lower(page.space.key) = :spaceKey and
		lower(page.title) = :pageTitle and
		page.originalVersion is null and
		page.contentStatus = 'current'
]]></query>

<query name="confluence.page_findLatestBySpaceKeyTitleOptimisedForComments"><![CDATA[
	from Page page 
	left join fetch page.comments as theComments
	left join fetch theComments.children 
	where lower(page.space.key) = :spaceKey and
		lower(page.title) = :pageTitle and
		page.originalVersion is null and
		page.contentStatus = 'current'
]]></query>