Here's a suggestion - please bear in mind I don't know exactly how transactions are stored in the database, so it could be this is already incorporated. Also, I know 0.8 stores the data in a different container which I have not yet studied.
At the moment, in order to verify a transaction, a bitcoin client has to dereference the inputs, then trawl the whole blockchain making sure it has not already been redeemed. Is that correct? If so, then: wouldn't it be clever to leave enough bytes (50 or so) inside each transaction output in the blockchain, to store the eventual redeeming transaction & vin?
So for example, at the moment, transactions are stored as (simplified):
txid, (txid:vout, txid:vout, ...), (addr:value, addr:value, ...)
where the first parenthesis are the inputs, and the second the outputs.
I would change that to:
txid, (txid:vout, txid:vout, ...), (addr:value:0x00000, addr:value:txid:vin, ....)
where the first output has not yet been redeemed and has 50 bytes of empty 0x0. The second output has been redeemed and the 50 bytes of 0x0 have been overwritten with the (txid,vin) with which this transaction output has been redeemed. This would reduce verification on each transaction input to a single db lookup on a unique index (the txid).
edit: from
https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages, step 14 of verifying a transaction is:
"For each input, if the referenced output has already been spent by a transaction in the main branch, reject this transaction"
I suppose this is just one more database query, right? So maybe this suggestion is not so useful given that it would add 50 bytes or so for each tx output. ok, never mind.