SQL查询的速度有多慢?

时间:2021-12-31 23:37:07

I have a server-side code written in Node.js that makes 6 SQL queries in one request. The queries consist of mostly SELECT statements with a couple of INNER JOIN and OUTER JOIN.

我有一个用Node.js编写的服务器端代码,它在一个请求中生成6个SQL查询。查询主要由SELECT语句组成,其中包含一些INNER JOIN和OUTER JOIN。

They take about 4ms when I run them directly in command-line.

当我直接在命令行中运行它们时,它们需要大约4ms。

I am curious at what point they would be considered slow and I'll have to maybe start memcaching the results. Coming from front-end world, 4ms seems extremely fast!

我很好奇他们在什么时候会被认为是慢的,我将不得不开始记忆结果。来自前端世界,4ms似乎非常快!

1 个解决方案

#1


2  

What is considered slow with respect to SQL queries?

SQL查询的速度有多慢?

Anything the user complains about.

用户抱怨的任何内容。

And of course that is not always rational but it is the only meaningful anwer. The quesiton is so dependant on context; a OLTP system will have different characteristics from an OLAP one. Also, what might be fast for a single DB lookup may be slow with 6.

当然,这并不总是理性的,但它是唯一有意义的回答。问题是如此依赖于背景; OLTP系统将具有与OLAP系统不同的特性。此外,对于单个数据库查找而言可能很快的速度可能会慢6。

If the finished product is slow to use worry about it, otherwise focus on other aspects of quality. Of course is something presents itwelf to enable you to improve performance do so but don't look for problems before they exist.

如果成品使用缓慢担心,否则要注重质量的其他方面。当然,有些东西可以帮助你提高性能,但不要在它们存在之前寻找问题。

#1


2  

What is considered slow with respect to SQL queries?

SQL查询的速度有多慢?

Anything the user complains about.

用户抱怨的任何内容。

And of course that is not always rational but it is the only meaningful anwer. The quesiton is so dependant on context; a OLTP system will have different characteristics from an OLAP one. Also, what might be fast for a single DB lookup may be slow with 6.

当然,这并不总是理性的,但它是唯一有意义的回答。问题是如此依赖于背景; OLTP系统将具有与OLAP系统不同的特性。此外,对于单个数据库查找而言可能很快的速度可能会慢6。

If the finished product is slow to use worry about it, otherwise focus on other aspects of quality. Of course is something presents itwelf to enable you to improve performance do so but don't look for problems before they exist.

如果成品使用缓慢担心,否则要注重质量的其他方面。当然,有些东西可以帮助你提高性能,但不要在它们存在之前寻找问题。