Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hackaton 2024][cobalt][Javascript] EC72 - Perform an SQL query inside a loop #101

Open
lmarie23 opened this issue May 29, 2024 · 0 comments
Assignees
Labels
checkers Hackathon 2024 New issues tagged during the hackathon 2024

Comments

@lmarie23
Copy link

lmarie23 commented May 29, 2024

Associated rule title

Perform an SQL query inside a loop

Associated rule link

EC72

Language and platform

SQL/Javascript

Measure justification

SQL queries within a loop pose major performance problems, especially if the SQL server(s) is (are) not on the local machine. These servers are optimised to handle several selections, insertions or modifications in a single query or transaction.

Used incorrectly, these queries consume unnecessary CPU cycles, RAM and bandwidth.

Public articles

Test protocol

Scenarios

  1. The loop runs multiple SQL queries (1 per row) for 300000 row.
  2. The loop runs a single SQL query for 300000 rows.
  3. Repeat 5 times in total

A more precise description is available in the source repository

Tools

Validation

Indicate whether the measurement performed validates or invalidates this rule.

Indicate the percentage of certainty of this validation (0% for "I'm not sure at all", 100% for "I'm certain of the result")

The tests validate the rule with 100%.

The time of execution is always longer with multiple SQL queries, but there was a glitch in one run when considering the resource consumption.
The tests would benefit from more runs, and different usage monitoring tools.

@lmarie23 lmarie23 added checkers Hackathon 2024 New issues tagged during the hackathon 2024 labels May 29, 2024
@lmarie23 lmarie23 changed the title Draft:[Hackaton 2024][cobalt][Typescript] EC72 - Perform an SQL query inside a loop Draft:[Hackaton 2024][cobalt][Javascript] EC72 - Perform an SQL query inside a loop May 30, 2024
@lmarie23 lmarie23 changed the title Draft:[Hackaton 2024][cobalt][Javascript] EC72 - Perform an SQL query inside a loop [Hackaton 2024][cobalt][Javascript] EC72 - Perform an SQL query inside a loop May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
checkers Hackathon 2024 New issues tagged during the hackathon 2024
Projects
None yet
Development

No branches or pull requests

2 participants