cockroachdb / cockroachdb/cockroach
sql: not applying plangrams after placeholder fast path
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
If a statement qualifies for the placeholder fast path, then we don't apply a PlanGram during optimization, even if there is one for the statement. For example:
```sql
CREATE TABLE xy (x INT PRIMARY KEY, y INT);
EXPLAIN (VERBOSE) SELECT * FROM xy WHERE x = 10;
-- point-lookup in xy_pkey
SELECT information_schema.crdb_pin_plan_gram(
'SELECT * FROM xy WHERE x = _',
'root: (Select (Scan));'
);
EXPLAIN (VERBOSE) SELECT * FROM xy WHERE x = 10;
-- filter over a full scan of xy_pkey
PREPARE p AS SELECT * FROM xy WHERE x = $1;
EXPLAIN ANALYZE (VERBOSE) EXECUTE p(10);
-- but this plan still uses a point lookup, doesn't respect the pinned plan
```
Jira issue: CRDB-65700
Epic: CRDB-66266
Contributor guide
Assessment
This issue has not been assessed yet.