mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-13 15:22:30 +00:00
docs: fix SQL examples a deployment rejects
- CREATE INDEX: the example left out USING, which the server requires, and the page said SQL cannot choose the algorithm or name the index. USING names the algorithm, the page lists them, and a name before ON is taken where the deployment's configuration allows it. - The search join passed fts() a bare string; fts() takes JSON. - Sampling a subquery's result is refused, so the sampling and subquery pages sample the table inside the subquery, and the refusals list it. - Two unaliased casts in one projection produce the same column name; the example aliases them. - A json_get nested in another json_get is refused. The page shows one level of nesting and json_extract with a JSONPath for deeper values, and corrects what json_extract and json_extract_with_type return.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: "Index"
|
||||
sidebarTitle: "Index"
|
||||
description: "CREATE INDEX and DROP INDEX — one column, server-chosen name."
|
||||
description: "CREATE INDEX and DROP INDEX — one column, with the algorithm chosen by USING."
|
||||
icon: bolt
|
||||
keywords: ["create index", "drop index", "sql"]
|
||||
---
|
||||
@@ -11,14 +11,20 @@ keywords: ["create index", "drop index", "sql"]
|
||||
## CREATE INDEX {#create}
|
||||
|
||||
```sql
|
||||
CREATE INDEX ON documents (title)
|
||||
CREATE INDEX ON documents USING btree (title)
|
||||
CREATE INDEX text_search ON documents USING fts (text)
|
||||
```
|
||||
|
||||
`USING` is required: it names the algorithm. The scalar algorithms are `btree`,
|
||||
`bitmap` and `label_list`; `fts` builds a full-text index; and the vector
|
||||
algorithms are `ivf_pq`, `ivf_rq`, `ivf_flat`, `ivf_hnsw_sq` and `ivf_hnsw_pq`,
|
||||
where the deployment supports them. Index options go in a `WITH (...)` clause.
|
||||
|
||||
<Note>
|
||||
SQL `CREATE INDEX` covers **one column** and takes **no user-chosen name** --
|
||||
the server names it. For a multi-column or explicitly-named index, or to
|
||||
choose the algorithm, use the SDK's
|
||||
[`create_index`](/indexing).
|
||||
On a deployment, SQL `CREATE INDEX` covers **one column**. A name between
|
||||
`INDEX` and `ON` names the index, where the deployment's configuration allows
|
||||
it; without one, the server names it after the column, as in `title_idx`. For a
|
||||
multi-column index, use the SDK's [`create_index`](/indexing).
|
||||
</Note>
|
||||
|
||||
<Note>
|
||||
|
||||
Reference in New Issue
Block a user