What are some good solutions for analyzing Bitcoin script patterns?
It seems that bitcoin-iterate implements your second suggestion:


  This is some fast code to iterate over bitcoind's block files to extract blockchain data from the main blockchain.


But as far as I know it doesn't allow your to filter by script. That would be a nice addition to the project, I think. Or you could write something similar that did that.