cockroachdb / cockroachdb/cockroach
explain: import into shows wrong number of request units consumed
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**REPRO:**
1. Start the host:
`./cockroach start-single-node --insecure`
2. Create a tenant:
`./cockroach sql --insecure -e "SELECT crdb_internal.create_tenant(5);"`
3. Start the tenant:
`./cockroach mt start-sql --insecure --tenant-id=5 --sql-addr=:27000 --http-addr=:27001`
4. Create a table and insert 100K rows:
`./cockroach sql --insecure --url="postgresql://localhost:27000" -e "CREATE TABLE kv (k INT8 PRIMARY KEY, v BYTES); INSERT INTO kv (k, v) SELECT x, repeat('x', 1024)::bytes FROM generate_series(1,100000) g(x)"`
5. Export the table into a CSV:
`./cockroach sql --insecure --url="postgresql://localhost:27000" -e "SELECT * FROM kv" --format=csv > kv.csv`
6. Run a local HTTP server to serve the CSV:
`python3 -m http.server 3000`
7. Create a table to import into:
`./cockroach sql --insecure --url="postgresql://localhost:27000" -e "CREATE TABLE kv2 (k INT8 PRIMARY KEY, v BYTES)"`
8. `EXPLAIN ANALYZE` an import of the table:
`./cockroach sql --insecure --url="postgresql://localhost:27000" -e "EXPLAIN ANALYZE IMPORT INTO kv2 (k, v) CSV DATA ('http://localhost:3000/kv.csv')"`
**EXPECTED:**
The EXPLAIN output should show ~300K estimated RUs consumed.
**ACTUAL:**
The EXPLAIN output only shows ~42 estimated RUs consumed:
```
info
-----------------------------------
planning time: 61µs
execution time: 5.1s
distribution: local
vectorized: true
maximum memory usage: 10 KiB
network usage: 0 B (0 messages)
estimated RUs consumed: 42
isolation level: serializable
priority: normal
quality of service: regular
• import
nodes: n2
actual row count: 1
KV contention time: 0µs
(15 rows)
```
Jira issue: CRDB-33223
Contributor guide
Assessment
This issue has not been assessed yet.