Comparison of Different Solutions

Shared Disk Failover Shared disk failover avoids synchronization overhead by having only one copy of the database. It uses a single disk array that is shared by multiple servers. If the main database server fails, the standby server is able to mount and start the database as though it were recovering from a database crash. This allows rapid failover with no data loss. Shared hardware functionality is common in network storage devices. Using a network file system is also possible, though care

COMMIT

NameCOMMIT -- commit the current transaction Synopsis COMMIT [ WORK | TRANSACTION ] Description COMMIT commits the current transaction. All changes made by the transaction become visible to others and are guaranteed to be durable if a crash occurs. Parameters WORKTRANSACTION Optional key words. They have no effect. Notes Use ROLLBACK to abort a transaction. Issuing COMMIT when not inside a transaction does no harm, but it will provoke a warning message. Examples To comm

Combining Multiple Indexes

A single index scan can only use query clauses that use the index's columns with operators of its operator class and are joined with AND. For example, given an index on (a, b) a query condition like WHERE a = 5 AND b = 6 could use the index, but a query like WHERE a = 5 OR b = 6 could not directly use the index. Fortunately, PostgreSQL has the ability to combine multiple indexes (including multiple uses of the same index) to handle cases that cannot be implemented by single index scans. The sys

Collation Support

The collation feature allows specifying the sort order and character classification behavior of data per-column, or even per-operation. This alleviates the restriction that the LC_COLLATE and LC_CTYPE settings of a database cannot be changed after its creation. 23.2.1. Concepts Conceptually, every expression of a collatable data type has a collation. (The built-in collatable data types are text, varchar, and char. User-defined base types can also be marked collatable, and of course a domain ov

COMMENT

NameCOMMENT -- define or change the comment of an object Synopsis COMMENT ON { ACCESS METHOD object_name | AGGREGATE aggregate_name ( aggregate_signature ) | CAST (source_type AS target_type) | COLLATION object_name | COLUMN relation_name.column_name | CONSTRAINT constraint_name ON table_name | CONSTRAINT constraint_name ON DOMAIN domain_name | CONVERSION object_name | DATABASE object_name | DOMAIN object_name | EXTENSION object_name | EVENT TRIGGER object_name |

Combining Queries

The results of two queries can be combined using the set operations union, intersection, and difference. The syntax is query1 UNION [ALL] query2 query1 INTERSECT [ALL] query2 query1 EXCEPT [ALL] query2 query1 and query2 are queries that can use any of the features discussed up to this point. Set operations can also be nested and chained, for example query1 UNION query2 UNION query3 which is executed as: (query1 UNION query2) UNION query3 UNION effectively appends the result of query2 to t

clusterdb

Nameclusterdb -- cluster a PostgreSQL database Synopsis clusterdb [connection-option...] [--verbose | -v] [ --table | -t table ] ... [dbname] clusterdb [connection-option...] [--verbose | -v] --all | -a Description clusterdb is a utility for reclustering tables in a PostgreSQL database. It finds tables that have previously been clustered, and clusters them again on the same index that was last used. Tables that have never been clustered are not affected. clusterdb is a wrapper around th

citext

The citext module provides a case-insensitive character string type, citext. Essentially, it internally calls lower when comparing values. Otherwise, it behaves almost exactly like text. F.8.1. Rationale The standard approach to doing case-insensitive matches in PostgreSQL has been to use the lower function when comparing values, for example SELECT * FROM tab WHERE lower(col) = LOWER(?); This works reasonably well, but has a number of drawbacks: It makes your SQL statements verbose, and you

chkpass

This module implements a data type chkpass that is designed for storing encrypted passwords. Each password is automatically converted to encrypted form upon entry, and is always stored encrypted. To compare, simply compare against a clear text password and the comparison function will encrypt it before comparing. There are provisions in the code to report an error if the password is determined to be easily crackable. However, this is currently just a stub that does nothing. If you precede an in

CLUSTER

NameCLUSTER -- cluster a table according to an index Synopsis CLUSTER [VERBOSE] table_name [ USING index_name ] CLUSTER [VERBOSE] Description CLUSTER instructs PostgreSQL to cluster the table specified by table_name based on the index specified by index_name. The index must already have been defined on table_name. When a table is clustered, it is physically reordered based on the index information. Clustering is a one-time operation: when the table is subsequently updated, the changes