Skip to content

Instantly share code, notes, and snippets.

@sidazhang

sidazhang/schema Secret

Created December 17, 2013 06:18
Show Gist options
  • Save sidazhang/a735d334a68a6e00d335 to your computer and use it in GitHub Desktop.
Save sidazhang/a735d334a68a6e00d335 to your computer and use it in GitHub Desktop.
Schema
List of relations
Schema | Name | Type | Owner | Size | Description
--------+--------------+----------+-------------+------------+-------------
public | addr | table | testnetuser | 52 MB |
public | addr_id_seq | sequence | testnetuser | 8192 bytes |
public | addr_txout | table | testnetuser | 135 MB |
public | blk | table | testnetuser | 32 MB |
public | blk_id_seq | sequence | testnetuser | 8192 bytes |
public | blk_tx | table | testnetuser | 41 MB |
public | names | table | testnetuser | 8192 bytes |
public | schema_info | table | testnetuser | 16 kB |
public | tx | table | testnetuser | 145 MB |
public | tx_id_seq | sequence | testnetuser | 8192 bytes |
public | txin | table | testnetuser | 1105 MB |
public | txin_id_seq | sequence | testnetuser | 8192 bytes |
public | txout | table | testnetuser | 161 MB |
public | txout_id_seq | sequence | testnetuser | 8192 bytes |
public | unconfirmed | view | testnetuser | 0 bytes |
Table "public.addr"
Column | Type | Modifiers | Storage | Description
---------+---------+---------------------------------------------------+----------+-------------
id | integer | not null default nextval('addr_id_seq'::regclass) | plain |
hash160 | text | not null | extended |
Indexes:
"addr_pkey" PRIMARY KEY, btree (id)
"addr_hash160_index" btree (hash160)
Has OIDs: no
Table "public.addr_txout"
Column | Type | Modifiers | Storage | Description
----------+---------+-----------+---------+-------------
addr_id | integer | not null | plain |
txout_id | integer | not null | plain |
Indexes:
"addr_txout_addr_id_index" btree (addr_id)
"addr_txout_txout_id_index" btree (txout_id)
Has OIDs: no
Table "public.blk"
Column | Type | Modifiers | Storage | Description
-----------+---------+--------------------------------------------------+----------+-------------
id | integer | not null default nextval('blk_id_seq'::regclass) | plain |
hash | bytea | not null | extended |
depth | integer | not null | plain |
version | bigint | not null | plain |
prev_hash | bytea | not null | extended |
mrkl_root | bytea | not null | extended |
time | bigint | not null | plain |
bits | bigint | not null | plain |
nonce | bigint | not null | plain |
blk_size | integer | not null | plain |
chain | integer | not null | plain |
work | bytea | | extended |
aux_pow | bytea | | extended |
Indexes:
"blk_pkey" PRIMARY KEY, btree (id)
"blk_hash_key" UNIQUE CONSTRAINT, btree (hash)
"blk_depth_index" btree (depth)
"blk_hash_index" btree (hash)
"blk_prev_hash_index" btree (prev_hash)
"blk_work_index" btree (work)
Has OIDs: no
Table "public.blk_tx"
Column | Type | Modifiers | Storage | Description
--------+---------+-----------+---------+-------------
blk_id | integer | not null | plain |
tx_id | integer | not null | plain |
idx | integer | not null | plain |
Indexes:
"blk_tx_blk_id_index" btree (blk_id)
"blk_tx_tx_id_index" btree (tx_id)
Has OIDs: no
Table "public.names"
Column | Type | Modifiers | Storage | Description
----------+---------+-----------+----------+-------------
txout_id | integer | not null | plain |
hash | bytea | | extended |
name | bytea | | extended |
value | bytea | | extended |
Indexes:
"names_hash_index" btree (hash)
"names_name_index" btree (name)
"names_txout_id_index" btree (txout_id)
Has OIDs: no
Table "public.tx"
Column | Type | Modifiers | Storage | Description
-----------+------------------------+-------------------------------------------------+----------+-------------
id | integer | not null default nextval('tx_id_seq'::regclass) | plain |
hash | character varying(255) | not null | extended |
version | bigint | not null | plain |
lock_time | bigint | not null | plain |
coinbase | boolean | not null | plain |
tx_size | integer | not null | plain |
Indexes:
"tx_pkey" PRIMARY KEY, btree (id)
"tx_hash_key" UNIQUE CONSTRAINT, btree (hash)
"tx_hash_index" btree (hash)
Has OIDs: no
Table "public.txin"
Column | Type | Modifiers | Storage | Description
----------------+---------+---------------------------------------------------+----------+-------------
id | integer | not null default nextval('txin_id_seq'::regclass) | plain |
tx_id | integer | not null | plain |
tx_idx | integer | not null | plain |
prev_out_index | bigint | not null | plain |
sequence | bigint | not null | plain |
script_sig | bytea | | extended |
prev_out | bytea | | extended |
Indexes:
"txin_pkey" PRIMARY KEY, btree (id)
"txin_tx_id_index" btree (tx_id)
Has OIDs: no
Table "public.txout"
Column | Type | Modifiers | Storage | Description
-----------+---------+----------------------------------------------------+----------+-------------
id | integer | not null default nextval('txout_id_seq'::regclass) | plain |
tx_id | integer | not null | plain |
tx_idx | integer | not null | plain |
pk_script | bytea | not null | extended |
value | bigint | | plain |
type | integer | not null | plain |
Indexes:
"txout_pkey" PRIMARY KEY, btree (id)
"txout_tx_id_index" btree (tx_id)
"txout_type_index" btree (type)
Has OIDs: no
View "public.unconfirmed"
Column | Type | Modifiers | Storage | Description
-----------+------------------------+-----------+----------+-------------
id | integer | | plain |
hash | character varying(255) | | extended |
version | bigint | | plain |
lock_time | bigint | | plain |
coinbase | boolean | | plain |
tx_size | integer | | plain |
View definition:
SELECT tx.id,
tx.hash,
tx.version,
tx.lock_time,
tx.coinbase,
tx.tx_size
FROM tx
WHERE NOT (EXISTS ( SELECT 1
FROM blk_tx
WHERE blk_tx.tx_id = tx.id))
ORDER BY tx.id DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment