cloudflare / cloudflare/developer-platform

🐛 BUG: Very wrong metrics reported for row reads after a `execute --file` (3 order of magnitude bigger than expected).

Abierto
#44 0 comentarios 0 reacciones 0 asignados Ver en GitHub
product:d1
Lenguaje dominante
Sin datos de lenguaje
Estrellas
1
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Which Cloudflare product(s) does this pertain to?

D1

### What version(s) of the tool(s) are you using?

3.67.1

### What version of Node are you using?

18.19.0

### What operating system and version are you using?

Linux Manjaro (arch)

### Describe the Bug

### Observed behavior
After an execution of `DELETE` statement from a sql file, the metric returned in the terminal (the same number is in the web dashboard) for rows read was astronomically bigger than it should be:
```sh
npx wrangler d1 execute prods --file $rm_rows_sql --remote
#returns
rows read: 70344030 (web dash display 70.72M)
```
`prods` db has close to 12K rows.
the executed slq file is something like this:
```sql
DELETE FROM products WHERE tid IN (5, 22, 34, 38, 41, 50, 57, 64, 90, 98,..)
```
where the list of values is about 1k integers and `tid` is indexed. The statement was correctly applied and it took only a few seconds.

### Expected behavior
A correct number of rows read, something like:

```sh
sqlite> .read del_not_shared.sql
QUERY PLAN (cycles=113272102 [100%])
`--SEARCH products USING INTEGER PRIMARY KEY (rowid=?) (cycles=26065003 [23%] loops=1 rows=1272)
```

### Steps to reproduce
Please provide the following:
- A minimal working subset of your worker code
- A minimal working subset of your `wrangler.toml`
- Commands used to start your local dev server, including custom env and cli args
- Steps to be performed in the browser, curl commands, or a test we can run that reliably fails (at least a percent of the time)

A git repo we can clone and run a test suite on, or which has a README with step-by-step instructions, is even better. In this case, please use the field below to provide a link to the minimal repro.

### Please provide a link to a minimal reproduction

_No response_

### Please provide any relevant error logs

_No response_

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con el comando reportado `npx wrangler d1 execute ... --file ... --remote` y el archivo SQL de DELETE; compara su métrica de filas leídas en la terminal con el resultado esperado del plan de consulta de SQLite. Se considera hecho cuando el comando informa de un recuento plausible de filas leídas para el DELETE indexado, acorde con el comportamiento esperado descrito en el issue.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
node.js, sql, sqlite
Área
cli, databases
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.