Hacker News new | ask | show | jobs
by otterley 17 days ago
Why would using a stored procedure reduce I/O? I can see it reducing network round trips, but not storage reads and writes.
1 comments

I was referring to network I/O. But disk I/O should be at least as good for a stored procedure and often better. It’s classic “bring the computation to the data”. Putting the computation into the DB means that use of disk caching (up to and including CPU caching) is maximized.

Pulling the data out of the DB to do computation in a higher layer cannot be more efficient in terms of any I/O unless your stored procedure is just poorly written. It might be a win if your DB is compute bound, though.

Agreed.