Pagila
======

Pagila is a port of the Sakila example database available for MySQL, which was  
originally developed by Mike Hillyer of the MySQL AB documentation team. It  
is intended to provide a standard schema that can be used for examples in 
books, tutorials, articles, samples, etc.

All the tables, data, views, and functions have been ported; some of the changes made were:

* Changed char(1) true/false fields to true boolean fields
* The last_update columns were set with triggers to update them
* Added foreign keys
* Removed 'DEFAULT 0' on foreign keys since it's pointless with real FK's
* Used Tsearch2 index+trigger for fulltext index.  Removed the need for the
  film_text table.
* The rewards_report function was ported to a simple SRF

The schema and data for the Sakila database were made available under the BSD license which can be found at http://www.opensource.org/licenses/bsd-license.php. The pagila database is made available under this license as well.  


FULLTEXT SEARCH
---------------

In order to add fulltext index search to the film table (as is in the MySQL)
version of the pagila database, you need to:

1. Create the pagila database and run the pagila-schema.sql script in it.
2. Install the contrib/tsearch2 shared libraries.
3. Install the contrib/tsearch2/tsearch2.sql script into the pagila database.
4. Run the pagila-fulltext.sql script in the pagila database.
5. See the pagila-fulltext.sql script's comments to see how to use the fulltext
   search.

PARTITIONED TABLES
------------------

The payment table is designed as a partitioned table with a 6 month timespan for the date ranges. If you want to take full advantage of table partitioning, you need to make sure constraint_exclusion is turned on in your database. You can do this by setting "constraint_exclusion = on" in your postgresql.conf, or by issuing the command "ALTER DATABASE pagila SET constraint_exclusion = on" (substitute pagila for your database name if installing into a database with a different name)


VERSION HISTORY
---------------
Version 0.9
* Add table partitioning example 

Version 0.8 
* First release of pagila


