#!/bin/bash # -*- sh-indentation: 2; sh-basic-offset: 2-*- # This is based on codes from Michael Paquier and Tomas Vondra: # * https://www.postgresql.org/message-id/flat/Zbr6piWuVHDtFFOl%40paquier.xyz#dbbec4d5c54ef2317be01a54abaf495c # * https://www.postgresql.org/message-id/flat/26541788-8853-4d93-86cd-5f701b13ae51%40enterprisedb.com DIR=${1:-$(pwd)} psql postgres > /dev/null 2>&1 < /dev/null 2>&1 < /dev/null 2>&1 < /dev/null 2>&1 d=$(psql test -t -A -c "SELECT 1000 * (EXTRACT(EPOCH FROM now()) - $s)") echo "TO,${format},${n_columns},${n_rows},${r},${d}" done # run COPY FROM 5x for r in $(seq 1 5); do s=$(psql test -t -A -c "SELECT EXTRACT(EPOCH FROM now())") psql test -c "COPY from_table FROM '$DIR/test.data' WITH (FORMAT ${format})" > /dev/null 2>&1 d=$(psql test -t -A -c "SELECT 1000 * (EXTRACT(EPOCH FROM now()) - $s)") echo "FROM,${format},${n_columns},${n_rows},${r},${d}" done done done done