Topic: Why different speed of request from IBExpert and from the program?
Kind time of days, help to understand?
[spoiler Here such plain request]
select tc. ID; (with N as ( select NAME from TFIOS t inner join SPFIOS s on s. ID=t. IDFIO where t. IDCAT = tc. ID and t.idkind = 1 order by NAME) select list (NAME, ', ') from N) as FIOS from TCATALOG tc order by tc. ID
From IBExpert it is fulfilled perfectly, all data for some seconds.
[spoiler Sbatsal all it in a flow in Delfi, here so]
procedure TFillUpFIOsThread. Execute; var D: TpFIBDataset; RecC: Integer; begin inherited; try LaDB: = TFIBDatabase. Create (nil); LaTRN: = TFIBTransaction. Create (nil); LaDB.DefaultTransaction: = LaTRN; D: = TpFIBDataSet. Create (LaDB); D.Database: = LaDB; D.Transaction: = LaTRN; LaDB.LibraryName: = DM.FIBDB.LibraryName; LaDB.UseLoginPrompt: = False; LaDB.DatabaseName: = DM.FIBDB.DatabaseName; LaDB.DBParams: = DM.FIBDB.DBParams; LaDB.SQLDialect: = DM.FIBDB.SQLDialect; LaDB.DefaultTransaction: = LaTRN; LaTRN.DefaultDatabase: = LaDB; LaTRN.TRParams: = DM.TRNRead. TRParams; LaDB.Connected: = True; with D do begin SelectSQL.Text: = ' select count (ID) from TCATALOG '; Open; RecC: = Fields .AsInteger; Close; SelectSQL.Clear; //SelectSQL.Text: = ' select c. ID, (SELECT FIOS FROM CONSTRUCTFIOSLIST (c. ID)) as AUTHLIST from TCATALOG c order by c. ID '; SelectSQL.Add (' select c. ID, '); SelectSQL.Add (' (with N as ('); SelectSQL.Add (' select NAME '); SelectSQL.Add (' from '); SelectSQL.Add (' TFIOS t inner join SPFIOS s on s. ID=t. IDFIO '); SelectSQL.Add (' where t. IDCAT = c. ID and t.idkind = 1 '); SelectSQL.Add (' order by NAME) '); SelectSQL.Add (' select list (NAME ",") '); SelectSQL.Add (' from N) as AUTHLIST '); SelectSQL.Add (' from TCATALOG c ');//order by c. ID Open; while not EOF do begin if Terminated then Exit; //mutex? ahz MainForm. FIOsList. Add (Fields .AsInteger, Fields .AsString); if RecNo mod 1000 = 0 then begin PBPos: = Round (RecNo / RecC * 100); Synchronize (MainForm. DrawPBPos); end; Next; end; Close; end; finally FreeAndNil (D); FreeAndNil (LaTRN); FreeAndNil (LaDB); Synchronize (MainForm. HidePB); if not Terminated then FreeAndNil (MainForm. FillUpFIOsThread); end; end;
Speed on pair orders more slowly, than from IBE, why?
There is a procedure doing almost same ( a line). If to preempt through it, speed normal and from Delfi. But it would be desirable to understand, why the request from the program so slowly works?