cloudflare / cloudflare/developer-platform

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

Aperta
#44 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
product:d1
Lingua principale
Nessun dato sulla lingua
Stelle
1
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con il comando segnalato `npx wrangler d1 execute ... --file ... --remote` e il file SQL DELETE; confronta la sua metrica delle righe lette nel terminale con il risultato atteso del piano di query di SQLite. Il lavoro è completato quando il comando riporta un conteggio plausibile delle righe lette per il DELETE indicizzato, in linea con il comportamento previsto descritto nell’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
node.js, sql, sqlite
Ambito
cli, databases
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.