Skip to content

Commit 2ec2ef1

Browse files
committed
fix: update docs
1 parent 098c7b8 commit 2ec2ef1

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

docs/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,13 @@ SELECT * FROM adbc_scan(getvariable('conn')::BIGINT, 'SELECT * FROM large_table'
267267

268268
### adbc_scan_table
269269

270-
Scans an entire table by name and returns all rows. This is a convenience function that generates `SELECT * FROM "table_name"` internally.
270+
Scans an entire table by name and returns all rows. This function provides advanced optimizations compared to `adbc_scan`:
271+
272+
- **Projection pushdown**: Only requested columns are fetched from the remote database
273+
- **Filter pushdown**: WHERE clauses are pushed to the remote database with parameter binding for SQL injection safety
274+
- **Cardinality estimation**: Row count statistics are fetched from the driver for query planning
275+
- **Progress reporting**: Scan progress is reported based on estimated row counts
276+
- **Column statistics**: Distinct count, null count, and min/max values are provided to the query optimizer (when available from the driver via `AdbcConnectionGetStatistics`)
271277

272278
```sql
273279
adbc_scan_table(connection_id, table_name, [batch_size := N]) -> TABLE
@@ -290,12 +296,25 @@ SELECT * FROM adbc_scan_table(getvariable('conn')::BIGINT, 'users');
290296
-- With batch size hint
291297
SELECT * FROM adbc_scan_table(getvariable('conn')::BIGINT, 'large_table', batch_size := 65536);
292298

299+
-- Projection pushdown: only 'name' and 'email' columns are fetched
300+
SELECT name, email FROM adbc_scan_table(getvariable('conn')::BIGINT, 'users');
301+
302+
-- Filter pushdown: WHERE clause is executed on the remote database
303+
SELECT * FROM adbc_scan_table(getvariable('conn')::BIGINT, 'users')
304+
WHERE id = 42 AND status = 'active';
305+
306+
-- Combined projection and filter pushdown
307+
SELECT name, email FROM adbc_scan_table(getvariable('conn')::BIGINT, 'users')
308+
WHERE department = 'Engineering' AND salary > 100000;
309+
293310
-- Combine with DuckDB operations
294311
SELECT department, AVG(salary) as avg_salary
295312
FROM adbc_scan_table(getvariable('conn')::BIGINT, 'employees')
296313
GROUP BY department;
297314
```
298315

316+
**Note:** Filter pushdown uses parameterized queries (e.g., `WHERE id = ?`) to prevent SQL injection. Filters that cannot be pushed down are applied locally by DuckDB after fetching the data.
317+
299318
### adbc_execute
300319

301320
Executes DDL or DML statements (CREATE, INSERT, UPDATE, DELETE).

duckdb

Submodule duckdb updated 269 files

0 commit comments

Comments
 (0)