http://qs321.pair.com?node_id=688202


in reply to A profiling surprise ...

51 calls to execute() takes 19 seconds? (Without much data, I'm making wild conjectures ...) that seems long, but it sort of makes sense if the database returns all of the results to the client upon execute, and there are a lot of results, and fetch() just iterates through those results. And maybe you need to look at the queries and the indexes on the tables.