Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

padraig=# \d t1;
Table "public.t1"
Column | Type | Modifiers
--------+------------------------+-----------
id | integer | not null
text | character varying(255) | not null
Indexes:
"t1_pkey" PRIMARY KEY, btree (id)
padraig=# select * from t1;
@posulliv
posulliv / gist:91095
Created April 7, 2009 04:10
A query plan in PostgreSQL with a hash join
padraig=# explain select t2.text from t1, t2 where t1.id = t2.id;
QUERY PLAN
--------------------------------------------------------------
Hash Join (cost=1.07..2.16 rows=4 width=21)
Hash Cond: (t2.id = t1.id)
-> Seq Scan on t2 (cost=0.00..1.04 rows=4 width=25)
-> Hash (cost=1.03..1.03 rows=3 width=4)
-> Seq Scan on t1 (cost=0.00..1.03 rows=3 width=4)
(5 rows)
case T_HashJoinState:
result= ExecHashJoin((HashJoinState *) node);
break;
$ cd /path/to/postgres/src/dir
$ ./configure --prefix=/path/to/install/dir --enable-debug --enable-cassert
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Incorrect number of arguments"
echo "Usage"
echo "./script ROOT_DIR_OF_POSTGRES_INSTALL"
exit 1
fi
$ ./my_script.sh /usr/src/cmsc724/vp
posulliv 16588 16118 0 21:26 ? 00:00:00 postgres: posulliv bench [local] idle
(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".
Attaching to program: /usr/src/cmsc724/vp/bin/postgres, process 16588
Reading symbols from /lib/libcrypt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.
$ ./my_script.sh /usr/src/cmsc724/vp
posulliv 16588 16118 0 21:26 ? 00:00:00 postgres: posulliv bench [local] idle
posulliv 16614 16118 0 21:29 ? 00:00:00 postgres: posulliv bench [local] idle
$
$ psql -d bench
Welcome to psql 8.3.6, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
bench=# select pg_backend_pid();
#!/bin/bash
if [ $# -ne 1 ]
then
echo "incorrect number of arguments"
echo "Usage"
echo "./script DRIZZLE_BUILD_ROOT_DIR"
exit 1
fi
$ cd /path/to/drizzle_source/tests
$ ./dtr --start-and-exit --gdb