From: <ma...@us...> - 2006-11-28 18:00:20
|
Revision: 1726 http://svn.sourceforge.net/osdldbt/?rev=1726&view=rev Author: markwkm Date: 2006-11-28 10:00:07 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Incorporated the table loading with the table creation script to take advantage of a new PostgreSQL feature in 8.2. Loading the database is faster when the COPY is run in the same transaction as the CREATE TABLE statement. The database will not log the loading in this case. Modified Paths: -------------- trunk/dbt3/configure.ac trunk/dbt3/scripts/pgsql/create_tables.sh.in trunk/dbt3/scripts/pgsql/load_test.sh.in Removed Paths: ------------- trunk/dbt3/scripts/pgsql/load_db.sh.in Modified: trunk/dbt3/configure.ac =================================================================== --- trunk/dbt3/configure.ac 2006-11-28 17:49:43 UTC (rev 1725) +++ trunk/dbt3/configure.ac 2006-11-28 18:00:07 UTC (rev 1726) @@ -1,7 +1,7 @@ AC_PREREQ(2.59) dnl Process this file with autoconf to produce a configure script. -AC_INIT(dbt3, 1.9, osd...@li...) +AC_INIT(dbt3, 1.10-pre1, osd...@li...) AM_INIT_AUTOMAKE dnl Checks for programs. @@ -149,8 +149,6 @@ [chmod +x scripts/pgsql/drop_tables.sh]) AC_CONFIG_FILES([scripts/pgsql/grant.sh], [chmod +x scripts/pgsql/grant.sh]) - AC_CONFIG_FILES([scripts/pgsql/load_db.sh], - [chmod +x scripts/pgsql/load_db.sh]) AC_CONFIG_FILES([scripts/pgsql/pgsql_profile], [chmod +x scripts/pgsql/pgsql_profile]) AC_CONFIG_FILES([scripts/pgsql/q_time.sh], Modified: trunk/dbt3/scripts/pgsql/create_tables.sh.in =================================================================== --- trunk/dbt3/scripts/pgsql/create_tables.sh.in 2006-11-28 17:49:43 UTC (rev 1725) +++ trunk/dbt3/scripts/pgsql/create_tables.sh.in 2006-11-28 18:00:07 UTC (rev 1726) @@ -1,18 +1,45 @@ #!/bin/bash - # # This file is released under the terms of the Artistic License. # Please see the file LICENSE, included in this package, for details. # -# Copyright (C) 2005 Jenny Zhang & Open Source Development Labs, Inc. +# Copyright (C) 2005-2006 Jenny Zhang & Open Source Development Labs, Inc. # DIR=`dirname $0` . ${DIR}/pgsql_profile || exit 1 +# Load tables +# This background stuff is honestly kinda ugly. IMO the right way to do this is to utilize make -j +load_table() { + table=${1} + create=${2} + if [ x${3} == x ]; then + file=${table}.tbl + else + file=${3}.tbl + fi + + local sql="COPY ${table} FROM '${DBDATA}/${file}' USING DELIMITERS '|';" + local cmd="@PSQL@ -e -d ${SID} -1 -c " + if [ x${BACKGROUND} == xyes ]; then + echo "Loading ${table} table in the background..." + ${cmd} "${create} ${sql} VACUUM ANALYZE ${table};" || exit 1 & + else + echo "Loading $table table..." + ${cmd} "${create} ${sql}" || exit 1 + fi +} + USE_TABLESPACES=0 -while getopts "t" OPT; do +while getopts "bd:t" OPT; do case ${OPT} in + b) + BACKGROUND=yes + ;; + d) + DBDATA=${OPTARG} + ;; t) USE_TABLESPACES=1 ;; @@ -59,7 +86,7 @@ ${PSQL} "CREATE ${REGION_TABLESPACE} LOCATION '${TS_REGION_DIR}';" fi -${PSQL} " +load_table supplier " CREATE TABLE supplier ( s_suppkey INTEGER, s_name CHAR(25), @@ -69,9 +96,9 @@ s_acctbal REAL, s_comment VARCHAR(101)) ${SUPPLIER_TABLESPACE}; -" || exit 1 +" -${PSQL} " +load_table part " CREATE TABLE part ( p_partkey INTEGER, p_name VARCHAR(55), @@ -83,9 +110,9 @@ p_retailprice REAL, p_comment VARCHAR(23)) ${PART_TABLESPACE}; -" || exit 1 +" -${PSQL} " +load_table partsupp " CREATE TABLE partsupp ( ps_partkey INTEGER, ps_suppkey INTEGER, @@ -93,9 +120,9 @@ ps_supplycost REAL, ps_comment VARCHAR(199)) ${PARTSUPP_TABLESPACE}; -" || exit 1 +" -${PSQL} " +load_table customer " CREATE TABLE customer ( c_custkey INTEGER, c_name VARCHAR(25), @@ -106,9 +133,9 @@ c_mktsegment CHAR(10), c_comment VARCHAR(117)) ${CUSTOMER_TABLESPACE}; -" || exit 1 +" -${PSQL} " +load_table orders " CREATE TABLE orders ( o_orderkey INTEGER, o_custkey INTEGER, @@ -120,9 +147,9 @@ o_shippriority INTEGER, o_comment VARCHAR(79)) ${ORDERS_TABLESPACE}; -" || exit 1 +" -${PSQL} " +load_table lineitem " CREATE TABLE lineitem ( l_orderkey INTEGER, l_partkey INTEGER, @@ -141,24 +168,24 @@ l_shipmode CHAR(10), l_comment VARCHAR(44)) ${LINEITEM_TABLESPACE}; -" || exit 1 +" -${PSQL} " +load_table nation " CREATE TABLE nation ( n_nationkey INTEGER, n_name CHAR(25), n_regionkey INTEGER, n_comment VARCHAR(152)) ${NATION_TABLESPACE}; -" || exit 1 +" -${PSQL} " +load_table region " CREATE TABLE region ( r_regionkey INTEGER, r_name CHAR(25), r_comment VARCHAR(152)) ${REGION_TABLESPACE}; -" || exit 1 +" ${PSQL} " CREATE TABLE time_statistics ( @@ -168,4 +195,6 @@ int_time INTEGER); " || exit 1 +wait + exit 0 Deleted: trunk/dbt3/scripts/pgsql/load_db.sh.in =================================================================== --- trunk/dbt3/scripts/pgsql/load_db.sh.in 2006-11-28 17:49:43 UTC (rev 1725) +++ trunk/dbt3/scripts/pgsql/load_db.sh.in 2006-11-28 18:00:07 UTC (rev 1726) @@ -1,63 +0,0 @@ -#!/bin/bash - -# -# This file is released under the terms of the Artistic License. Please see -# the file LICENSE, included in this package, for details. -# -# Copyright (C) 2002-2006 Open Source Development Labs, Inc. -# History: -# June-4-2003 Create by Jenny Zhang -# - -. @TOPDIR@/scripts/dbt3_profile || exit 1 - -USE_TABLESPACES=0 -DBDATA=${DSS_PATH} -while getopts "bd:t" OPT; do - case ${OPT} in - b) - BACKGROUND=yes - ;; - d) - DBDATA=${OPTARG} - ;; - t) - USE_TABLESPACES=1 - ;; - esac -done - -# Load tables -# This background stuff is honestly kinda ugly. IMO the right way to do this is to utilize make -j -load_table() { - table=$1 - if [ x$2 == x ]; then - file=$table.tbl - else - file=$2.tbl - fi - - local sql="COPY $table FROM '${DBDATA}/$file' USING DELIMITERS '|';" - local cmd="@PSQL@ -e -d ${SID} -c " - if [ x$BACKGROUND == xyes ]; then - echo "Loading $table table in the background..." - ${cmd} "${sql} VACUUM ANALYZE $table;" || exit 1 & - else - echo "Loading $table table..." - ${cmd} "${sql}" || exit 1 - fi -} - -echo "Loading table tables... " -load_table supplier -load_table part -load_table partsupp -load_table customer -load_table orders -load_table lineitem -load_table nation -load_table region - -wait - -exit 0 Modified: trunk/dbt3/scripts/pgsql/load_test.sh.in =================================================================== --- trunk/dbt3/scripts/pgsql/load_test.sh.in 2006-11-28 17:49:43 UTC (rev 1725) +++ trunk/dbt3/scripts/pgsql/load_test.sh.in 2006-11-28 18:00:07 UTC (rev 1726) @@ -109,8 +109,6 @@ $DBSCRIPTDIR/create_db.sh -o ${OUTPUT_DIR} -p "${PARAMETERS}" || exit 1 -$DBSCRIPTDIR/create_tables.sh ${TABLESPACE_FLAG} || exit 1 - echo "`date +'%Y-%m-%d %H:%M:%S'` Starting Load Test..." s_time=`$GTIME` $DBSCRIPTDIR/record_start.sh -n "LOAD" @@ -119,7 +117,7 @@ $DBSTATS $SID $OUTPUT_DIR & date -${DBSCRIPTDIR}/load_db.sh -d ${DBDATA} ${TABLESPACE_FLAG} || exit 1 +${DBSCRIPTDIR}/create_tables.sh -d ${DBDATA} ${TABLESPACE_FLAG} || exit 1 date if [ ${ONLY_LOAD} -eq 0 ]; then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |