r72573 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72572‎ | r72573 | r72574 >
Date:06:13, 8 September 2010
Author:siebrand
Status:ok
Tags:
Comment:
* Follow-up r72570: svn eol-style:native
* Trimmed trailing spaces
Modified paths:
  • /trunk/phase3/docs/databases/postgres.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/databases/postgres.txt
@@ -3,18 +3,18 @@
44
55 == Overview ==
66
7 -Support for PostgreSQL has been available since version 1.7
8 -of MediaWiki, and is fairly well maintained. The main code
9 -is very well integrated, while extensions are very hit and miss.
 7+Support for PostgreSQL has been available since version 1.7
 8+of MediaWiki, and is fairly well maintained. The main code
 9+is very well integrated, while extensions are very hit and miss.
1010 Still, it is probably the most supported database after MySQL.
11 -Much of the work in making MediaWiki database-agnostic came
 11+Much of the work in making MediaWiki database-agnostic came
1212 about through the work of creating Postgres support.
1313
1414
1515 == Required versions ==
1616
17 -The current minimum version of PostgreSQL for MediaWiki is 8.1.
18 -It is expected that this will be raised to 8.3 at some point,
 17+The current minimum version of PostgreSQL for MediaWiki is 8.1.
 18+It is expected that this will be raised to 8.3 at some point,
1919 as 8.1 and 8.2 are nearing end of life.
2020
2121
@@ -23,79 +23,78 @@
2424
2525 Postgres has its own schema file at maintenance/postgres/tables.sql.
2626
27 -The goal is to keep this file as close as possible to the canonical
28 -schema at maintenance/tables.sql, but without copying over
 27+The goal is to keep this file as close as possible to the canonical
 28+schema at maintenance/tables.sql, but without copying over
2929 all the usage comments. General notes on the conversion:
3030
31 -* The use of a true TIMESTAMP rather than the text string that
32 -MySQL uses is highly encouraged. There are still places in the
33 -code (especially extensions) which make assumptions about the
34 -textual nature of timestamp fields, but these can almost always
 31+* The use of a true TIMESTAMP rather than the text string that
 32+MySQL uses is highly encouraged. There are still places in the
 33+code (especially extensions) which make assumptions about the
 34+textual nature of timestamp fields, but these can almost always
3535 be programmed around.
3636
37 -* Although Postgres has a true BOOLEAN type, boolean columns
38 -are always mapped to SMALLINT, as the code does not always treat
39 -the column as a boolean (which is limited to accepting true,
 37+* Although Postgres has a true BOOLEAN type, boolean columns
 38+are always mapped to SMALLINT, as the code does not always treat
 39+the column as a boolean (which is limited to accepting true,
4040 false, 0, 1, t, or f)
4141
42 -* The default data type for all VARCHAR, CHAR, and VARBINARY
43 -columns should simply be TEXT. The only exception is
44 -when VARBINARY is used to store true binary data, such as
 42+* The default data type for all VARCHAR, CHAR, and VARBINARY
 43+columns should simply be TEXT. The only exception is
 44+when VARBINARY is used to store true binary data, such as
4545 the math_inputhash column, in which case BYTEA should be used.
4646
47 -* All integer variants should generally be mapped to INTEGER.
48 -There is small-to-no advantage in using SMALLINT versus
49 -INTEGER in Postgres, and the possibility of running out of
50 -room outweighs such concerns. The columns that are BIGINT
51 -in other schemas should be INTEGER as well, as none of them
52 -so far are even remotely likely to reach the 32 billion
 47+* All integer variants should generally be mapped to INTEGER.
 48+There is small-to-no advantage in using SMALLINT versus
 49+INTEGER in Postgres, and the possibility of running out of
 50+room outweighs such concerns. The columns that are BIGINT
 51+in other schemas should be INTEGER as well, as none of them
 52+so far are even remotely likely to reach the 32 billion
5353 limit of an INTEGER.
5454
55 -* Blobs (blob, tinyblog, mediumblob) should be mapped to TEXT
56 -whenever possible, and to BYTEA if they are known to contain
 55+* Blobs (blob, tinyblog, mediumblob) should be mapped to TEXT
 56+whenever possible, and to BYTEA if they are known to contain
5757 binary data.
5858
59 -* All length modifiers on data types should be removed. If
60 -they are on an INTEGER, it's probably an error, and if on
 59+* All length modifiers on data types should be removed. If
 60+they are on an INTEGER, it's probably an error, and if on
6161 any text-based field, simply using TEXT is preferred.
6262
63 -* Sequences should be explicitly named rather than using
 63+* Sequences should be explicitly named rather than using
6464 SERIAL, as the code can depend on having a specific name.
6565
66 -* Foreign keys should be used when possible. This makes things
67 -both easier and harder in the code, but most of the major
68 -problems have now been overcome. Always add an explicit ON DELETE
69 -clause, and consider carefully what choice to use (all things
 66+* Foreign keys should be used when possible. This makes things
 67+both easier and harder in the code, but most of the major
 68+problems have now been overcome. Always add an explicit ON DELETE
 69+clause, and consider carefully what choice to use (all things
7070 considered, prefer CASCADE).
7171
72 -* The use of CIDR should be done very carefully, because the code
73 -will sometimes want to store things such as an empty string or
 72+* The use of CIDR should be done very carefully, because the code
 73+will sometimes want to store things such as an empty string or
7474 other non-IP value in the column. When in doubt, use TEXT.
7575
76 -* Indexes should be created using the original MySQL tables.sql
77 -as a guide, but keeping in mind the ability of Postgres to use
78 -partial indexes, functional indexes, and bitmaps. The index names
79 -should be logical but are not too important, as they are never
80 -referenced directly by the code (unlike sequence names). Most of
81 -the indexes in the file as of this writing are there due to production
 76+* Indexes should be created using the original MySQL tables.sql
 77+as a guide, but keeping in mind the ability of Postgres to use
 78+partial indexes, functional indexes, and bitmaps. The index names
 79+should be logical but are not too important, as they are never
 80+referenced directly by the code (unlike sequence names). Most of
 81+the indexes in the file as of this writing are there due to production
8282 testing of expensive queries on a busy wiki.
8383
8484
8585 == Keeping in sync with tables.sql ==
8686
87 -The script maintenance/postgres/compare_schemas.pl should be
88 -periodically run. It will parse both "tables.sql" files and
89 -produce any differences found. Such differences should be fixed
90 -or exceptions specifically carved out by editing the script
91 -itself. This script has also been very useful in finding problems
92 -in maintenance/tables.sql itself, as it is very strict in the
 87+The script maintenance/postgres/compare_schemas.pl should be
 88+periodically run. It will parse both "tables.sql" files and
 89+produce any differences found. Such differences should be fixed
 90+or exceptions specifically carved out by editing the script
 91+itself. This script has also been very useful in finding problems
 92+in maintenance/tables.sql itself, as it is very strict in the
9393 format it expects things to be in. :)
9494
9595
9696 == Getting help ==
9797
98 -In addition to the normal venues (MediaWiki mailing lists
99 -and IRC channels), the #postgresql channel on irc.freenode.net
100 -is a friendly and expert resource if you should encounter a
 98+In addition to the normal venues (MediaWiki mailing lists
 99+and IRC channels), the #postgresql channel on irc.freenode.net
 100+is a friendly and expert resource if you should encounter a
101101 problem with your Postgres-enabled MediaWiki.
102 -
Property changes on: trunk/phase3/docs/databases/postgres.txt
___________________________________________________________________
Added: svn:eol-style
103102 + native

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r72570Add quick doc for Postgresgreg01:58, 8 September 2010

Status & tagging log