Full relational diagram for Bitcoin public data on Google BigQuery
Find a full relational diagram for the Bitcoin data coming from an amazing opensource project https://github.com/blockchain-etl/bitcoin-etl. If you prefer to deal with star or snowflake schema more check out my simplified relational diagram.
Two RECORDS type fields in crypto_bitcoin.transactions
As each Bitcoin transaction can move money from multiple wallets (inputs) to multiple wallets (outputs) we need to be able to store this data in a two record type fields on the crypto_bitcoin.transactions.
Normalised schema using views
If you still prefer to use table joins vs array/UNNEST function then crypto_bitcoin.input and crypto_bitcoin.output might be helpful.
crypto_bitcoin.input is a view using the data crypto_bitcoin.transactions
crypto_bitcoin.output is a view using the data crypto_bitcoin.transactions
Partitioned tables - keeping cost low and queries fast!
- When working with crypto_bitcoin.blocks and crypto_bitcoin.transactions try to use partitioned field block_timestamp_month. This will speed up your queries and reduce your costs. In YYYY-MM-DD the DD is always 01.
WHERE transactions.block_timestamp_month = '2018-02-01'
WHERE blocks.block_timestamp_month = '2010-12-01'
SQL with partitioned field
Try out this query using a partitioned field.
SQL without a partitioned field