Hint injection docs#20830
Conversation
✅ Deploy Preview for cockroachdb-api-docs canceled.
|
✅ Deploy Preview for cockroachdb-interactivetutorials-docs canceled.
|
Files changed:
|
✅ Netlify Preview
To edit notification comments on pull requests, go to your Netlify project configuration. |
95d85db to
73b7928
Compare
|
✅ Cross-Version Link Check Passed All cross-version link issues have been resolved. Good job! |
73b7928 to
774dc87
Compare
774dc87 to
919fc5a
Compare
michae2
left a comment
There was a problem hiding this comment.
These docs are great! Just a couple corrections.
| {{site.data.alerts.callout_info}} | ||
| The `statement hints count` field shows the number of individual hints applied. A single row in `system.statement_hints` can contain multiple hints (such as an index hint and a join hint). | ||
| {{site.data.alerts.end}} | ||
|
|
There was a problem hiding this comment.
As of cockroachdb/cockroach#161043 there's also a new metric, sql.query.with_statement_hints.count, which counts the number of statement executions that used statement hints.
There was a problem hiding this comment.
I see the issue to document this metric. However, apparently metrics.yaml now has a visibility field that (separately from the presence of a release note) determines whether these metrics are supposed to be documented. Since this metric doesn't appear to have that field, and I'm not clear on this metrics policy right now, I'll have to defer this for now. Let me know if it's meant to have visibility though.
There was a problem hiding this comment.
I see. Let's skip documenting it for now.
d0153eb to
372f4f8
Compare
|
@michae2 Updated per your comments. PTAL! |
| ); | ||
| ~~~ | ||
|
|
||
| Fingerprints distinguish between queries with different inline hints. For example, the fingerprint `SELECT * FROM users WHERE city = _` does **not** match the statement `SELECT * FROM users@users_pkey WHERE city = 'new york'` (which matches the fingerprint `SELECT * FROM users@users_pkey WHERE city = _`). As a result, you can use `information_schema.crdb_rewrite_inline_hints()` to remove inline hints: |
| {{site.data.alerts.callout_info}} | ||
| The `statement hints count` field shows the number of individual hints applied. A single row in `system.statement_hints` can contain multiple hints (such as an index hint and a join hint). | ||
| {{site.data.alerts.end}} | ||
|
|
There was a problem hiding this comment.
I see. Let's skip documenting it for now.
| @@ -39,15 +39,16 @@ The user requires the appropriate [privileges]({% link {{ page.version.version } | |||
|
|
|||
| Parameter | Description | |||
There was a problem hiding this comment.
Not sure how helpful this is, but just noting here that there are two "levels" to EXPLAIN parameters: "modes" and "flags". There has to be 1 mode, and then 0 or more flags for that mode.
Modes:
- PLAN (the default if no modes are provided)
- OPT
- DISTSQL
- DDL
- VEC
- DEBUG
- GIST
- FINGERPRINT (new)
Flags:
- VERBOSE
- TYPES
- ENV
- CATALOG
- JSON
- MEMO
- SHAPE
- VIZ
- REDACT
It confuses things a little bit to document them all together, because they work a bit differently.
There was a problem hiding this comment.
Thank you! I will file this into a separate ticket.
There was a problem hiding this comment.
161545: docgen: update SHOW STATEMENT HINTS and EXPLAIN diagrams r=michae2 a=taroface Updated the diagram for `SHOW STATEMENT HINTS` (exposing the `DETAILS` option). Diagram looks like: <img width="547" height="274" alt="image" src="https://github.com/user-attachments/assets/1c66f39b-30b1-4dbf-a32b-893e4222db75" /> Also updated the `EXPLAIN` diagram to include the `FINGERPRINT` option: <img width="605" height="453" alt="image" src="https://github.com/user-attachments/assets/1f9d9b27-b8b4-4c60-b1d2-3b4ad6aafb87" /> This is related to the docs PR cockroachdb/docs#20830 Epic: none Release note: none Release justification: non-production code change Co-authored-by: Ryan Kuo <ryank@cockroachlabs.com>
161545: docgen: update SHOW STATEMENT HINTS and EXPLAIN diagrams r=michae2 a=taroface Updated the diagram for `SHOW STATEMENT HINTS` (exposing the `DETAILS` option). Diagram looks like: <img width="547" height="274" alt="image" src="https://github.com/user-attachments/assets/1c66f39b-30b1-4dbf-a32b-893e4222db75" /> Also updated the `EXPLAIN` diagram to include the `FINGERPRINT` option: <img width="605" height="453" alt="image" src="https://github.com/user-attachments/assets/1f9d9b27-b8b4-4c60-b1d2-3b4ad6aafb87" /> This is related to the docs PR cockroachdb/docs#20830 Epic: none Release note: none Release justification: non-production code change Co-authored-by: Ryan Kuo <ryank@cockroachlabs.com>
peachdawnleach
left a comment
There was a problem hiding this comment.
Just a couple of small comments; otherwise LGTM. Very thorough and clear
| -------|------|------------ | ||
| `row_id` | `INT` | A unique ID. | ||
| `fingerprint` | `STRING` | The SQL statement fingerprint that the hint applies to. | ||
| `hint_type` | `STRING` | `rewrite_inline_hints`, indicating an injected hint. |
There was a problem hiding this comment.
Not sure I understand this one- is rewrite_inline_hints the only possible value here? If not, it might be good to make that more clear.
There was a problem hiding this comment.
Yes, eventually there will be other hint types! I clarified this but somewhat more indirectly.
161545: docgen: update SHOW STATEMENT HINTS and EXPLAIN diagrams r=michae2 a=taroface Updated the diagram for `SHOW STATEMENT HINTS` (exposing the `DETAILS` option). Diagram looks like: <img width="547" height="274" alt="image" src="https://github.com/user-attachments/assets/1c66f39b-30b1-4dbf-a32b-893e4222db75" /> Also updated the `EXPLAIN` diagram to include the `FINGERPRINT` option: <img width="605" height="453" alt="image" src="https://github.com/user-attachments/assets/1f9d9b27-b8b4-4c60-b1d2-3b4ad6aafb87" /> This is related to the docs PR cockroachdb/docs#20830 Epic: none Release note: none Release justification: non-production code change Co-authored-by: Ryan Kuo <ryank@cockroachlabs.com>
DOC-15510
DOC-15833
DOC-15834
DOC-15838
DOC-15836
DOC-15276
DOC-15422
SHOW STATEMENT HINTS, using a SQL diagram to be updated in docgen: update SHOW STATEMENT HINTS and EXPLAIN diagrams cockroach#161545