简体   繁体   English

SQL Server Delphi Tokyo更新1下的性能缓慢firedac

[英]Slow performance firedac with SQL Server under Delphi Tokyo update 1

Using a simple query that returns 20.000 rows only takes 0.5 milliseconds with ADO, but using firedac it takes 30 seconds. 使用一个简单的查询返回20.000行,使用ADO仅需要0.5毫秒,而使用firedac则需要30秒。

This is the code used for FireDac and ADO test: 这是用于FireDac和ADO测试的代码:

procedure TForm18.Button1Click(Sender: TObject);
var
  i: DWORD;
begin
  i := GetTickCount;

  Query.DisableControls;
  Query.Active := false; // simple SQL SELECT * FROM TABLE
  Query.Active := true;
  Query.EnableControls;
  Caption :=  IntToStr(GetTickCount - i) + ' - ' + IntToStr(Query.RecordCount);
end;

Regards 问候

测试FireDac与ADO

Please try setting the ExtendedMetadata to False for better performance. 请尝试将ExtendedMetadata设置为False,以获得更好的性能。 Try using also the RecordCount property with the number of records expected and you may see better results. 尝试将RecordCount属性与预期的记录数一起使用,您可能会看到更好的结果。

That SELECT statement does not use any indexes so a full scan of the database is occurring. 该SELECT语句不使用任何索引,因此正在对数据库进行全面扫描。 Try to compare performance with a query that filter results and make use of indexes use indexes instead. 尝试将性能与过滤结果并利用索引的查询进行比较,而使用索引代替。

You can alos use ADMonitor to see how the application interacts with the database as explained here . 您可以使用阿洛斯到ADMonitor看到应用程序如何与数据库交互的解释在这里

Finally, I have read about slow performance when FireDac uses ODBC and also when FireDac reads BLOB data. 最后,我读到有关FireDac使用ODBC以及FireDac读取BLOB数据时性能降低的信息。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM