improve(MySQL) optimize queue to skip running queries (#22136)

### What does this PR do?
optimize advance method
after this optimizations
100k req the query bellow in 1 connection takes 792ms instead of 6s
```sql
SELECT CAST(1 AS UNSIGNED) AS x
```
1mi req of the query bellow with 10 connections takes 57.41s - 62.5s
instead of 162.50s, mysql2 takes 1516.94s for comparison
```sql
SELECT * FROM users_bun_bench LIMIT 100
```

### How did you verify your code works?
Tested and benchmarked + CI
This commit is contained in:
Ciro Spaciari
2025-08-25 21:12:12 -07:00
committed by GitHub
parent 00722626fa
commit 26c0f324f8

View File

@@ -658,7 +658,12 @@ fn advance(this: *@This()) void {
}
},
.binding, .running, .partial_response => {
offset += 1;
const total_requests_running = this.pipelined_requests + this.nonpipelinable_requests;
if (offset < total_requests_running) {
offset += total_requests_running;
} else {
offset += 1;
}
continue;
},
.success => {