Re: Performance problem on client/server
Posted in 1996
Billy Wheeler wrote: > > In reply to: > > OPEN select_records_cur using id # id was previously gotten > > IF SQLCA.SQLCODE = 0 THEN > > FETCH select_records_cur INTO f_record > > ....... > > What I am concerned about is whether or not > > the above code results in the entire table being loaded to the client > > and the SQL statement executed on the client. > > Not by itself. If you run this statement for one record, it should fetch > one record and only one record should go down the network. Of course, if you > run it 60000 times, it will send 60000 records down the network! :-) Nope. Sorry, but there's more to it than that. There are a couple of points to consider here. (Probably only the second applies in this case) Firstly the OPEN/FETCH of a cursor may do a lot more processing than you think. The engine may have to process all the data before it can return any rows at all - EG ORDER BY/MAX/MIN etc. Just fetching a single row may still be expensive if a lot of work has to be done. Secondly there is a buffered fetch system that means a single FETCH from the front end will (if the row size is << buffer size) result in multiple rows being sent be the engine. This can be tuned with FET_BUF_SIZE. Cosmo