user85334: I'm interested in analyzing the Bitcoin blockchain for occurrences of particular scripts and spending patterns. What are some good solutions for this? An ideal solution would let me filter transactions and outputs based on the contents of the locking and redeem scripts of single outputs as well as chains of outputs spending each other. 
I've thought about looping over blocks and transactions with the Bitcoin Core RPC interface. This strikes me as probably not the most efficient solution, as I/O with bitcoind would probably be a bottleneck. Another solution would be to parse the raw block files, load them into memory (in a streaming fashion, as I don't have 200+ GB of memory...) and operate on them there. That sounds like a lot of work, so I was hoping there are some existing solutions for that out there. 

user1026: 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.

user91194: I want to add my propose to this solution.
I have released the new parser called SpyCBlock, this is the simple parser blk file (multiprocessor).
With this parser is possible to serialize the blockchain into JSON, so blkxxxxx.dat -> blkxxxxx.json (also another type of serialization).
I think with the JSON version is possible to run your analysis and I have run the simple analisis on the type of script used on the Bitcoin network, this is an example.
I think the version JSON is a propose to simplification the analysis of the bitcoin blockchain.

85334: <p>I'm interested in analyzing the Bitcoin blockchain for occurrences of particular scripts and spending patterns. What are some good solutions for this? An ideal solution would let me filter transactions and outputs based on the contents of the locking and redeem scripts of single outputs as well as chains of outputs spending each other. </p>

<p>I've thought about looping over blocks and transactions with the Bitcoin Core RPC interface. This strikes me as probably not the most efficient solution, as I/O with <code>bitcoind</code> would probably be a bottleneck. Another solution would be to parse the raw block files, load them into memory (in a streaming fashion, as I don't have 200+ GB of memory...) and operate on them there. That sounds like a lot of work, so I was hoping there are some existing solutions for that out there. </p>
 1026: <p>It seems that <a href="https://github.com/rustyrussell/bitcoin-iterate" rel="nofollow noreferrer">bitcoin-iterate</a> implements your second suggestion:</p>

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

<p>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.</p>
 91194: <p>I want to add my propose to this solution.</p>

<p>I have released the new parser called <a href="https://vincenzopalazzo.github.io/SpyCblock/" rel="nofollow noreferrer">SpyCBlock</a>, this is the simple parser blk file (multiprocessor).</p>

<p>With this parser is possible to serialize the blockchain into JSON, so blkxxxxx.dat -> blkxxxxx.json (also another type of serialization).
I think with the JSON version is possible to run your analysis and I have run the simple analisis on the type of script used on the Bitcoin network, <a href="https://vincenzopalazzo.github.io/AnalyticsPyBlock/" rel="nofollow noreferrer">this is an example</a>.</p>

<p>I think the version JSON is a propose to simplification the analysis of the bitcoin blockchain.</p>
