Database Administration

XWiki uses by default a database to store its data. You will find on this page tips and tricks to administer and tune your database setup. For Installation please check the Installation page which contains information on how to setup XWiki for multiple databases.


To improve your XWiki instance when running with many documents you should run the following script to create indexes for your database. This has been tested for MySQL 4.x and 5.0.

create index xwd_name on xwikidoc (xwd_name);
create index xwd_fullname on xwikidoc (xwd_fullname);
create index xwd_web on xwikidoc (xwd_web);
create index xwd_name on xwikiobjects (xwo_name);
create index xwl_value on xwikilongs (xwl_value);
create index xwi_value on xwikiintegers (xwi_value);
create index xws_value on xwikistrings (xws_value);
create index xwl_value on xwikilargestrings (xwl_value(50));
create index xwo_classname on xwikiobjects (xwo_classname);
create index xwd_creation_date on xwikidoc (xwd_creation_date);
create index xwd_date on xwikidoc (xwd_date);
create index xwd_content_update_date on xwikidoc (xwd_content_update_date);
create index xwd_content_author on xwikidoc (xwd_content_author);
create index xwd_author on xwikidoc (xwd_author);
create index xwd_creator on xwikidoc (xwd_creator);
create index xwd_language on xwikidoc (xwd_language);
create index xwd_default_language on xwikidoc (xwd_default_language);
create index xwd_title on xwikidoc (xwd_title);
create index xwd_parent on xwikidoc (xwd_parent(50));

Sanity Checks

To verify the consistency of your XWiki database you can run the sanity check script. The script will select rows that are inconsistent with the logics of XWiki. If no rows are selected, it means the script itself can not detect any error.

  • If you use MySQL as your database :
  • If you use postgresql as your database :
    • Here is a modified version of the sanity check script, to be run in the "query" tool of pgAdmin. It is the same as the script for MySQL, except that the syntax for SQL comments is different.
    • pgAdmin is the GUI tool provided with postgresql to access the database. Run pgAdmin, select the xwiki database, and choose the "Query" option in the "Tools" menu. Then just open the script and click on the play icon ("Execute query").

Get Connected