CF - QoQ与查询 [英] CF - QoQ vs Query

查看:169
本文介绍了CF - QoQ与查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个概念,调用查询的查询比从数据库的查询更快,因为减慢是在cf和db之间的通信。这是真的。

I've got a notion that calling a query of queries is faster than a query from database, because the slowdown is in the communication between cf and the db. Is this true.

这意味着循环中的QoQ是可以接受的,而循环中的查询不是。

Does that mean that a QoQ within a loop is acceptable, whereas a query within a loop is not.

推荐答案

完全DBMS是为处理[适当编写的]查询而高度优化的,而在现代网络上,开销不会很大。

Full DBMS are highly optimised for processing [appropriately-written] queries, and on a modern network the overhead is not going to be huge.

QoQ使用嵌入式数据库执行,根据正在执行的查询的类型,这些数据库可能会被优化或不被优化。

QoQ are performed using an embedded database, which may or not be well optimised, depending on the type of query being performed.

如果数据库在不同的机器上,跨越缓慢的网络,QoQ可能在一些情况下较慢。如果你打到数据库,你最好希望在一个请求中得到一切适当的处理,避免循环和重新处理循环。

So, if the database is on a different machine, across a slow network, the QoQ might be less slow in some situations. If you're hitting the database at all, you ideally want to get everything processed appropriately there, in one request, and avoid both round-trips and re-processing in a loop.

当然,QoQ的一个很大的好处是你可以使用它来处理不是来自数据库的数据 - 例如cfdirectory的结果或已经转换为查询的CSV文件。

Of course, a big benefit of QoQ is that you can use it to process data that doesn't come from a database - such as the results of cfdirectory or a CSV file that has been converted to a query.



ColdFusion通过手动解析SQL然后循环访问记录集来执行QoQ。这使得对于简单操作(例如具有匹配键的两表连接,但对于复杂组合(其中连接使用多个列和/或不是直的a = b比较)效率较低)有效。 (此处的简介)。

Railo使用 H2 。 H2声称快,他们的网站提供一些速度比较,建议它比Derby和MySQL更快 - 但当然最好寻找独立的第三方测试,更不要说这些测试不是QoQ性能的保证(例如我怀疑没有索引)。

Railo uses H2. H2 claims to be fast, and their website offers some speed comparisons that suggest it is faster than Derby and MySQL - but of course it would be best to look for independent third-party tests, not to mention that these tests are not guarantees of QoQ performance (which I suspect wont have indexes, for example).



一般情况下:如果不进行性能测试,不做任何硬性决定,以确定您确实需要提高性能,并能够客观地确定哪个方法其实更快。


In general: don't make any hard decision without first doing performance testing to determine that you actually need to improve performance, and to be able to objectively determine which method is actually faster.

这篇关于CF - QoQ与查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆