AdoQuery 如何处理 blob?

发布于 2024-12-26 05:31:37 字数 399 浏览 3 评论 0原文

我正在测试一些数据库组件,例如 SDAC 等,我发现了一些有趣的事情:

当我使用 TADOQuery 执行查询并且该查询有很多 blob 字段时,我 发现了一些有趣的事情:获取所有行 (fetchall) 我的应用程序的内存接近 1.8GB,一切正常。

使用其他组件时,在同一数据库上执行的同一查询会引发内存不足异常,因为它超过了 1.8GB 的​​内存使用量。

我知道我不应该返回所有这些行,我应该使用分页和 blablabla。但我很好奇 ADO 如何设法获取所有行而其他组件却不能。

我认为 ADO 正在压缩内存中的 blob,但这只是一个猜测。

有谁知道为什么 ADO 中的内存使用率这么好?

I am testing some databases components such as SDAC and others and I found out something interesting:

When I execute a query with TADOQuery and this query has a lot of blob fields and I get all rows (fetchall) the memory of my application gets close to 1.8GB and everything works fine.

Using other components, the same query executed on the same database trows an Out of Memory exception because it exceeds 1.8GB of memory usage.

I know I should not return all those rows, i should use pagination and blablabla. But i am curious how can ADO manage to get all rows and other components cant.

I think that ADO is compressing the blobs in memory, but this is only a guess.

Does anyone knows why memory usage in ADO is so good?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

才能让你更想念 2025-01-02 05:31:37

我不能谈论 SDAC,但会谈论 AnyDAC TADQuery:

  • 如果从 FetchOptions 中排除 fiBlob。< a href="http://www.da-soft.com/anydac/docu/uADStanOption_TADFetchOptions_Items.html" rel="nofollow">Items,则 AnyDAC 不会立即获取 BLOB 值。但会推迟获取,直到应用程序真正需要 BLOB 值;
  • 将 FormatOptions.InlineDataSize 设置为更小的值,将减少获取时的内存使用量具有多个字符字段的大型结果集;
  • 指定 FormatOptions.MapRules,应用程序可以选择更紧凑的数据类型表示。

此外,还有一些其他技术可以在获取大型结果集时减少内存使用。为了正确使用它们,开发人员应该知道将返回什么类型的数据。使用某些选项的代价可能是稍微降低获取性能。

I cannot say about SDAC, but will say about AnyDAC TADQuery:

  • if exclude fiBlobs from FetchOptions.Items, then AnyDAC will not fetch BLOB values immediately. But will defer fetching until the application will really need a BLOB value;
  • setting FormatOptions.InlineDataSize to more small value, will reduce memory usage on fetching large result set with multiple character fields;
  • specifying FormatOptions.MapRules, application may choose more compact data type representation.

Also there are few other techniques, allowing to reduce memory usage when fetching large result sets. To use them properly a developer should know what kind of data will be returned. The price of some options usage may be a slightly reduced fetch performance.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文