Page 1 of 1

how does fetchall work?

Posted: Tue 29 Aug 2006 21:31
by luis_augusto
1. I have a table with 10000 records (Using TMSTable component).
2. I am opening it with:
Cursortype = ctDefaultResultSet;
FetchAll = false;
FetchRows = 25;
ParamCheck:=true;
Options.QuoteNames:=true;
Options.FullRefresh:=true;
Options.LongStrings:=False;
Options.QuoteNames:=true;
Options.TrimFixedChar:=true;
Options.TrimVarChar:=true;
Options.RemoveOnRefresh:=true;
Options.AutoPrepare:=False;

3. According to the manual, opening this table should be prompt, due the small amount of initial fetching records, but it is not. It takes about 1 minute.

4. Even if I reduce or augment the fetchrows property, it does not seem to have any influence over the opening time.

5. What could possibly be the reason? How can I assure the initial retrieved set size is that I set up in Fetchrows?

6. The DBMonitor sentence, each time I open it, is "Select * from table". How does MSSQL "know" about the fetchrows number, since I am sending only that sentence thru network?

Thanks for any help.

Posted: Wed 30 Aug 2006 08:34
by Jackson
According to the manual, opening this table should be prompt, due the small amount of initial fetching records, but it is not. It takes about 1 minute.
Even if I reduce or augment the fetchrow property, it does not seem to have any influence over the opening time.
When setting TCustomMSDataSet.FetchAll = False you should keep in mind that execution of such queries blocks current session. In order to avoid blocking OLE DB creates additional session. Most possible creation of additional session takes so much time.
How does MSSQL "know" about the fetchrow if I am sending only that sentence thru network?
This is feature of OLE DB provider.

how does FetchAll work

Posted: Wed 30 Aug 2006 11:59
by luis_augusto
Then, Are you suggesting that amount of time spent in the blocking of the current session and the creation of new ones does not compensate the tiny retrieval of records during the table's opening process?

Why, or rather, when should I use fetchall=false, then, if not to speed the opening process?

Is there a way to circumvent this obstacle (long opening time) using another strategy than fetchAll=false? (taking in account that I am not talking neither about a detail table, nor a filtered table).

Thank you for you help.

Posted: Thu 31 Aug 2006 09:17
by Jackson
Limitations of FetchAll = False mode are limitations of MS SQL Server but not SDAC.
Connecting to MS SQL Server usually takes much less time than 1 minute.
Check your network configuration.
In the next SDAC version there will be NonBlockingFetch property. It will allow fetching asynchronously.