CF - QoQ vs Query

前端 未结 5 439
不知归路
不知归路 2021-01-18 23:57

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.

5条回答
  •  日久生厌
    2021-01-19 00:38

    It depends on the capabilities of your Coldfusion machine as compared to your database server, and the problem that you're trying to solve.

    QofQ will generally be very fast for small datasets because it all happens in your server memory. If you try to use QofQ on a large dataset though, your server will start to have problems due to the overhead involved with keeping and processing that data in memory.

    Database queries will generally outperform QofQ on large datasets because that's what they are designed for. Databases are good at processing large amounts of data very fast. Use them for that.

    If you're considering retrieving a large result set from the database and parsing it with QofQ, that is probably the wrong way to do it. Make the database reduce the results for you instead. If you're asking the database server for this information frequently, then cache it on your server.

    Keep in mind that this is all subjective and will depend a lot on your particular problem, load, database and server capabilities.

提交回复
热议问题