Wiki source code of Database Administration

Version 22.3 by Sergiu Dumitriu on 2011/02/17

Hide last authors
Silvia Macovei 19.2 1 {{box cssClass="floatinginfobox" title="**Contents**"}}{{toc/}}{{/box}}
Ludovic Dubost 1.1 2
Silvia Macovei 19.1 3 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>>Installation#HInstallandconfigureaRelationalDatabase]] page which contains information on how to setup XWiki for multiple databases.
Ludovic Dubost 1.1 4
Silvia Macovei 19.2 5 = Indexes =
Jean-Vincent Drean 7.1 6
Vincent Massol 17.2 7 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.
Ludovic Dubost 1.1 8
Silvia Macovei 19.1 9 {{info}}
Vincent Massol 22.2 10 There is now [[an application>>extensions:Extension.Check Config And Indexes Application]] to run this script automatically on XE and XEM directly from your wiki.
Silvia Macovei 19.1 11 {{/info}}
Vincent Massol 17.2 12
Anca Luca 21.1 13 ##{{{
Ludovic Dubost 1.1 14 create index xwd_name on xwikidoc (xwd_name);
15 create index xwd_fullname on xwikidoc (xwd_fullname);
16 create index xwd_web on xwikidoc (xwd_web);
GlennEveritt 8.1 17 create index xwo_name on xwikiobjects (xwo_name);
Ludovic Dubost 1.1 18 create index xwl_value on xwikilongs (xwl_value);
19 create index xwi_value on xwikiintegers (xwi_value);
20 create index xws_value on xwikistrings (xws_value);
21 create index xwl_value on xwikilargestrings (xwl_value(50));
22 create index xwo_classname on xwikiobjects (xwo_classname);
23 create index xwd_creation_date on xwikidoc (xwd_creation_date);
24 create index xwd_date on xwikidoc (xwd_date);
25 create index xwd_content_update_date on xwikidoc (xwd_content_update_date);
26 create index xwd_content_author on xwikidoc (xwd_content_author);
27 create index xwd_author on xwikidoc (xwd_author);
28 create index xwd_creator on xwikidoc (xwd_creator);
29 create index xwd_language on xwikidoc (xwd_language);
30 create index xwd_default_language on xwikidoc (xwd_default_language);
31 create index xwd_title on xwikidoc (xwd_title);
32 create index xwd_parent on xwikidoc (xwd_parent(50));
Ludovic Dubost 4.1 33 create index xwd_class_xml on xwikidoc (xwd_class_xml(20));
Raffaello Pelagalli 12.1 34 create index xwr_isdiff on xwikircs(xwr_isdiff);
Raffaello Pelagalli 13.1 35 create index xws_name on xwikistatsdoc (XWS_NAME);
36 create index xws_number on xwikistatsdoc (XWS_NUMBER);
37 create index xws_classname on xwikistatsdoc (XWS_CLASSNAME);
38 create index xws_action on xwikistatsdoc (XWS_ACTION);
39 create index xws_page_views on xwikistatsdoc (XWS_PAGE_VIEWS);
40 create index xws_unique_visitors on xwikistatsdoc (XWS_UNIQUE_VISITORS);
41 create index xws_period on xwikistatsdoc (XWS_PERIOD);
42 create index xws_visits on xwikistatsdoc (XWS_VISITS);
43 create index xwr_number on xwikistatsreferer (XWR_NUMBER);
44 create index xwr_name on xwikistatsreferer (XWR_NAME);
45 create index xwr_classname on xwikistatsreferer (XWR_CLASSNAME);
Ludovic Dubost 14.1 46 create index xwr_referer on xwikistatsreferer (XWR_REFERER(50));
Raffaello Pelagalli 13.1 47 create index xwr_page_views on xwikistatsreferer (XWR_PAGE_VIEWS);
48 create index xwr_period on xwikistatsreferer (XWR_PERIOD);
49 create index xwv_start_date on xwikistatsvisit (XWV_START_DATE);
50 create index xwv_name on xwikistatsvisit (XWV_NAME);
51 create index xwv_page_views on xwikistatsvisit (XWV_PAGE_VIEWS);
52 create index xwv_page_saves on xwikistatsvisit (XWV_PAGE_SAVES);
53 create index xwv_downloads on xwikistatsvisit (XWV_DOWNLOADS);
Vincent Massol 18.1 54 create index xwv_end_date on xwikistatsvisit (XWV_END_DATE);
55 create index xwv_ip on xwikistatsvisit (XWV_IP);
56 create index xwv_user_agent on xwikistatsvisit (XWV_USER_AGENT(255));
57 create index xwv_cookie on xwikistatsvisit (XWV_COOKIE(255));
58 create index xwv_unique_id on xwikistatsvisit (XWV_UNIQUE_ID);
59 create index xwv_classname on xwikistatsvisit (XWV_CLASSNAME);
60 create index xwv_number on xwikistatsvisit (XWV_NUMBER);
Ludovic Dubost 20.1 61 create index ase_requestid on activitystream_events (ase_requestid(200));
62 create index ase_stream on activitystream_events (ase_stream);
63 create index ase_date on activitystream_events (ase_date);
64 create index ase_type on activitystream_events (ase_type);
65 create index ase_application on activitystream_events (ase_application);
66 create index ase_user on activitystream_events (ase_user);
67 create index ase_wiki on activitystream_events (ase_wiki);
68 create index ase_space on activitystream_events (ase_space);
69 create index ase_page on activitystream_events (ase_page);
Sergiu Dumitriu 22.1 70 create index ase_page_date on activitystream_events (ase_page, ase_date);
Ludovic Dubost 20.1 71 create index xdd_fullname1 on xwikirecyclebin (xdd_fullname);
72 create index xdd_language on xwikirecyclebin (xdd_language);
73 create index xdd_date on xwikirecyclebin (xdd_date);
74 create index xdd_deleter on xwikirecyclebin (xdd_deleter);
75 create index xda_docid1 on xwikiattrecyclebin (xda_docid);
76 create index xda_doc_name on xwikiattrecyclebin (xda_doc_name);
77 create index xda_filename on xwikiattrecyclebin (xda_filename);
78 create index xda_date on xwikiattrecyclebin (xda_date);
79 create index xda_deleter on xwikiattrecyclebin (xda_deleter);
Anca Luca 21.1 80 }}}##
Ludovic Dubost 1.1 81
Silvia Macovei 19.2 82 = Sanity Checks =
Ludovic Dubost 1.1 83
jeanvivienmaurice 1.6 84 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.
jeanvivienmaurice 1.7 85
Silvia Macovei 19.1 86 * If you use **MySQL** as your database :
87 ** The following [[sanity check script>>attach:sanitycheck.sql]] has been tested for **MySQL 5.0**.
88 ** Another [[script>>attach:sanitycheck_MySQL4.sql]] is a variant of the previous script for **MySQL 4.x** replacing some syntax with more ancient one (still reports error in one command, please some MySQL guru to fix it...).
89 * If you use **postgresql** as your database :
90 ** Here is a [[modified version of the sanity check script>>attach:sanitycheck_postgresql.sql]], 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.
Vincent Massol 22.2 91 ** 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").
Jean-Vincent Drean 7.1 92
Silvia Macovei 19.2 93 = Database browsing =
Jean-Vincent Drean 7.1 94
Silvia Macovei 19.2 95 == DbVisualizer ==
Jean-Vincent Drean 7.1 96
97 http://www.dbvis.com/products/dbvis/download/install.jsp
98
Jean-Vincent Drean 7.2 99 Natively supported DBs :
Jean-Vincent Drean 7.1 100
101 * DB2 for Windows/Linux
102 * JavaDB/Derby
103 * MySQL
104 * PostgreSQL
Silvia Macovei 19.1 105 * [[more>>http://www.dbvis.com/products/dbvis/features/features.jsp?page=matrix]]
Jean-Vincent Drean 7.1 106
Jean-Vincent Drean 7.2 107 Any DB using the corresponding JDBC driver :
108
109 * Example HSQLDB by using the driver bundled with XWiki

Get Connected