how does fetchall work?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
luis_augusto
Posts: 43
Joined: Fri 14 Oct 2005 13:45

how does fetchall work?

Post by luis_augusto » Tue 29 Aug 2006 21:31

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.

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Wed 30 Aug 2006 08:34

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.

luis_augusto
Posts: 43
Joined: Fri 14 Oct 2005 13:45

how does FetchAll work

Post by luis_augusto » Wed 30 Aug 2006 11:59

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.

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Thu 31 Aug 2006 09:17

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.

Post Reply