cloudflare / cloudflare/developer-platform

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

Đang mở
#44 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
product:d1
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với lệnh được báo cáo `npx wrangler d1 execute ... --file ... --remote` và tệp SQL DELETE; so sánh chỉ số số hàng được đọc trong terminal của lệnh với kết quả kế hoạch truy vấn SQLite mong đợi. Hoàn thành khi lệnh báo cáo số lượng hàng được đọc hợp lý cho DELETE có lập chỉ mục, khớp với hành vi mong đợi được mô tả trong issue.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js, sql, sqlite
Lĩnh vực
cli, databases
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.