Optional Oracle Indexes

Last modified by superadmin on 2026/11/25 21:32

Three columns XWiki filters or orders on that its mappings leave unindexed, and why Oracle Text indexes are not needed.

Reference

XWiki declares the indexes it relies on in its Hibernate mappings, and Hibernate creates them together with the tables. Three columns it filters or orders on are not among them, and indexing those by hand can help an instance with a large page history. Create the indexes as the wiki's own Oracle user, once per wiki of the farm, since each wiki owns its own tables.

Page parent lookups

XWIKIDOC.XWD_PARENT carries no index, although the queries that list the children or the orphans of a page test it for equality.

CREATE INDEX XWD_PARENT_IDX ON XWIKIDOC (XWD_PARENT);

Deleted attachments

XWIKIATTRECYCLEBIN.XDA_DOCID carries no index either, although every listing of a page's deleted attachments filters on it. Its neighbours XDA_FILENAME, XDA_DATE and XDA_DOC_NAME are indexed by the mapping.

CREATE INDEX XDA_DOCID_IDX ON XWIKIATTRECYCLEBIN (XDA_DOCID);

Solr index synchronization

To find out which pages the Solr index is missing, XWiki walks the whole XWIKIDOC table in id order, reading the space, name, language, version and id of every page. An index holding exactly those columns lets Oracle answer from the index alone, without reading the table.

CREATE INDEX XWD_SOLR_ITERATE_IDX ON XWIKIDOC (XWD_ID, XWD_WEB, XWD_NAME, XWD_LANGUAGE, XWD_VERSION);

Oracle Text indexes are not needed

Older Oracle instructions also created CTXSYS.CONTEXT indexes on XWD_PARENT, on XWIKIDOC.XWD_CLASS_XML and on XWIKILARGESTRINGS.XWL_VALUE, and six more on the ACTIVITYSTREAM_EVENTS table. None of them helps a current instance. An Oracle Text index answers full text CONTAINS predicates, which XWiki does not issue because searching goes through Solr, and ACTIVITYSTREAM_EVENTS is only written by an instance configured with the old Hibernate event store instead of the default Solr one.

FAQ

Does an upgrade create or remove these indexes?

No. XWiki creates only the indexes declared in its Hibernate mappings, so these three are yours to create on each new wiki and to recreate if you ever drop them.

Which of them does my instance need?

Measure before creating any. Each one costs write time on a table XWiki writes to constantly, and only repays that on an instance whose page tree, recycle bin or Solr synchronization is measurably slow.

Are these indexes specific to Oracle?

The columns are not, but the statements are. Optional MySQL Indexes carries the equivalent statements for MySQL.

Related

Get Connected