TEMPDB Shrinking while selecting data via MFC CRecordset

TEMPDB Shrinking while selecting data via MFC CRecordset

Post by surf.. » Thu, 09 Jan 1997 04:00:00



Hi Everyone,

Have a strange problem where the tempdb space is shrinking when I select
a record using MFC CRecordset (actually a class derived from CRecordset).

These are the steps I perform:
1. Instantiate a CDatabase object.
2. Perform CDatabase.Open()
3. 'new' my CRecordset object by passing a pointer to the CDatabase
object (created in Step 2.)
4. Format a Query which looks like:
        "SELECT * FROM TableName WHERE UniqueIndexedColumn = SearchVal"
5. Open() the Recordset as a "snapshot" with the Query; Options param.
set to CRecordset::none (which amounts to Edit/Delete)
6. Grab the data in the first row and then ....
7. Perform CRecordset.Close()
8. 'delete' the CRecordset object.

Note: All the appropriate error checking is being performed.....

I beleive in the "Server Side Cursors" implementation, the keyset for the
records generated by the query are stored in tempdb.  But it does not
seem to get released after I perform CRecordset.Close() followed by the
delete of the CRecordset object.

In my experiments, I found the Open() "ing" & Close() "ing" of the
CDatabase object after getting rid of the CRecordset object seems to
drastically reduce the Shrinkage but is VERY EXPENSIVE & slows down
processing considerably.

Interestingly enough, this (Shrinking tempdb) phenomenon occurs even
if the table being queried is EMPTY !!.

Would really appreciate any kind of workaround/patch/info in this matter.

MFC++ Ver.:             4.2
SQLServer Version:      6.5
ODBC Driver:            SQLSRV32.DLL;
                        Version: 2.50.0126;
                        Dated: 8/7/95;
                        Size: 211,968 bytes.

Thanks in advance !!

Ravi.