| 1 |
|
| 2 |
# $Id$ |
| 3 |
|
| 4 |
# This is the start of a tests directory. |
| 5 |
|
| 6 |
# Right now you can start up a default database, like one owned by you, |
| 7 |
# and use psql |
| 8 |
|
| 9 |
psql -c '\i create.sql' |
| 10 |
|
| 11 |
# You can time importing the 5,000 sample data items by doing a |
| 12 |
|
| 13 |
time tclsh import_sampledata.tcl |
| 14 |
|
| 15 |
# You can time importing the 5,000 sample data items via a prepared |
| 16 |
# statement using |
| 17 |
|
| 18 |
time tclsh import_sampledata_prepared.tcl |
| 19 |
|
| 20 |
# You can time importing the 5,000 sample data items as one single |
| 21 |
# transaction using |
| 22 |
|
| 23 |
time tclsh import_sampledata_onetransaction.tcl |
| 24 |
|
| 25 |
# You can time importing the 5,000 sample data items as single |
| 26 |
# transaction but using a pre-prepared statement using |
| 27 |
|
| 28 |
time tclsh import_sampledata_prepared_onetransaction.tcl |
| 29 |
|
| 30 |
# You will see that batching lots of inserts into a single transaction is |
| 31 |
# much faster, and although even batching prepared statements as a single |
| 32 |
# transaction is much faster than separate transactions, its still slower |
| 33 |
# than import_sampledata_onetransaction, since it communicates each |
| 34 |
# insert separately to the server. |
| 35 |
# |
| 36 |
# The trouble with doing tons of inserts as one transaction is that any error |
| 37 |
# in any insert will abort the entire transaction. Postgres 8 is supposed |
| 38 |
# to have powerful new capabilities to handle errors in the middle of a |
| 39 |
# transaction without aborting the transaction. |
| 40 |
# |
| 41 |
# The data set is in sampledata.txt. |
| 42 |
|