I have a data set which is a large unweighted cyclic graph The cycles occur in loops of about 5-6 paths. It consists of about 8000 nodes and each node has from 1-6 (usually abou
Well, given the upvotes on the comment, I'll make it an answer now.
The SQL in the tight loop is definitely slowing you down. I don't care how fast the call is. Think about it -- you're asking for a query to be parsed, a lookup to be run -- as fast as that is, it's still in a tight loop. What does your data set look like? Can you just SELECT
the entire data set into memory, or at least work with it outside of MySQL?
If you work with that data in memory, you will see a significant performance gain.