X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=docs%2Fdatabase.txt;h=ba3045ed40dbdf539d12e7f91b0b7f922fa567f6;hb=05042d5c026123f3e40719cbc5bf78069b8508c0;hp=b9fa6ff7119332c974d53f39d576fa1bb56b082a;hpb=cb6f556784dad73d939951d3d1fa45cbe129e8be;p=lhc%2Fweb%2Fwiklou.git diff --git a/docs/database.txt b/docs/database.txt index b9fa6ff711..ba3045ed40 100644 --- a/docs/database.txt +++ b/docs/database.txt @@ -7,8 +7,8 @@ By Tim Starling, January 2006. For information about the MediaWiki database layout, such as a description of the tables and their contents, please see: - http://www.mediawiki.org/wiki/Manual:Database_layout - http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/maintenance/tables.sql?view=markup + https://www.mediawiki.org/wiki/Manual:Database_layout + https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob_plain;f=maintenance/tables.sql;hb=HEAD ------------------------------------------------------------------------ @@ -153,16 +153,13 @@ enclose small groups of queries in their own transaction. Use the following syntax: $dbw = wfGetDB( DB_MASTER ); -$dbw->begin(); +$dbw->begin( __METHOD__ ); /* Do queries */ -$dbw->commit(); +$dbw->commit( __METHOD__ ); Use of locking reads (e.g. the FOR UPDATE clause) is not advised. They are poorly implemented in InnoDB and will cause regular deadlock errors. -It's also surprisingly easy to cripple the wiki with lock contention. If -you must use them, define a new flag for $wgAntiLockFlags which allows -them to be turned off, because we'll almost certainly need to do so on -the Wikimedia cluster. +It's also surprisingly easy to cripple the wiki with lock contention. Instead of locking reads, combine your existence checks into your write queries, by using an appropriate condition in the WHERE clause of an @@ -180,9 +177,19 @@ MediaWiki does support the following other DBMSs to varying degrees. * PostgreSQL * SQLite * Oracle -* IBM DB2 * MSSQL More information can be found about each of these databases (known issues, level of support, extra configuration) in the "databases" subdirectory in this folder. + +------------------------------------------------------------------------ + Use of GROUP BY +------------------------------------------------------------------------ + +MySQL supports GROUP BY without checking anything in the SELECT clause. +Other DBMSs (especially Postgres) are stricter and require that all the +non-aggregate items in the SELECT clause appear in the GROUP BY. For +this reason, it is highly discouraged to use SELECT * with GROUP BY +queries. +