Contents
pg_timestamp
pg_timestamp ia an optional tool to skip parsing overhead of timestamp string. This is involved in a pg_bulkload package.
pg_timestamp_in
This user-defined function provides very fast loading of timestamp type data. For the speed, instead, the format of the timestamp data must satisfy the following 19byte format:
2007-01-01 12:34:56
- Year/Month/Day/Hour/Minute/Second, each must be represented using only digits (0x30 to 0x39, no month name, no AM/PM, etc.).
- Only a hyphen (0x2d) can be used (and must be used) to separate year, month and day.
- Single space (0x20) must appear between the day and the hour.
- Hour, minute and second must be separated using single colon (0x3a) respectively.
- No additional spaces and tabs are allowed.
Installation
Installation sequence is shown below. As a preliminary, the permissions of directories of PostgreSQL server should be set correctly.
$ cd [directory where postgresql-8.2or3.X.tar.gz is untared]/contrib/
$ tar zxvf pg_bulkload-2.3.X.tar.gz
$ cd pg_bulkload
$ make
$ make install
$ postgresql start
$ psql -f $PGHOME/share/contrib/pg_timestamp.sql database_name
Reminder
Timestamp value with timezone attribute is outside the scope of pg_timestamp_in.
If you provide data in such format, you must use usual
PostgreSQL feature to read data. In this case, you may need longer duration
to load. Although pg_timestamp_in provide much faster data loading for
timestamp data, it replaces usual PostgreSQL's internal function used to read
timestamp data. That is, use of pg_timestamp_in influences the data symtax
for PostgreSQL's SQL statements such as INSERT
, COPY
, and UPDATE
. To avoid
such influence, users have to use pg_timestamp_in only in the data loading,
and uninstall pg_timestamp_in.