In reply to:


Exactly. I assumed that odbc_exec opens the cursor, and odbc_fetch_row, well, does exactly that, fetches the row from it. Then again, it could be as you say, that odbc_exec fetches the whole result set into some internal buffer, and odbc_fetch_row just transfers a row into your variables. Well, I will be very disappointed it the later is the case.




Well Bonzi, prepare to be disappointed.
When you run a odbc_fetch_row it will generally by default fetch a large chunk of the rowset [beyond 10 rows - normally 10-20KB of data] into internal buffers when the first fetch_row is called.

This is what we call Firehose (client) cursors - you get more rows/data returned than you generally need.

You can force the ODBC driver to create a cursor on the Database Server rather than the client to help remove this problem, but this simply pushes the memory usage etc of the database server as it has to store the query resultset until the client asks for it or closes the cursor.
If the Database server and php server are the same the effect is probably neither here nor there.