You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- {% include {{ page.version.version }}/sql/vector-batch-inserts.md %}
2
+
- Creating a vector index through a backfill disables mutations ([`INSERT`]({% link {{ page.version.version }}/insert.md %}), [`UPSERT`]({% link {{ page.version.version }}/upsert.md %}), [`UPDATE`]({% link {{ page.version.version }}/update.md %}), [`DELETE`]({% link {{ page.version.version }}/delete.md %})) on the table. [#144443](https://github.com/cockroachdb/cockroach/issues/144443)
3
+
-`IMPORT INTO` is not supported on tables with vector indexes. You can import the vectors first and create the index after import is complete. [#145227](https://github.com/cockroachdb/cockroach/issues/145227)
4
+
- Only L2 distance (`<->`) searches are accelerated. [#144016](https://github.com/cockroachdb/cockroach/issues/144016)
5
+
- Index acceleration with filters is only supported if the filters match prefix columns. [#146145](https://github.com/cockroachdb/cockroach/issues/146145)
6
+
- Index recommendations are not provided for vector indexes. [#146146](https://github.com/cockroachdb/cockroach/issues/146146)
7
+
- Vector index queries may return incorrect results when the underlying table uses multiple column families. [#146046](https://github.com/cockroachdb/cockroach/issues/146046)
8
+
- Queries against a vector index may ignore filter conditions (e.g., a `WHERE` clause) when multiple vector indexes exist on the same `VECTOR` column, and one has a prefix column. [#146257](https://github.com/cockroachdb/cockroach/issues/146257)
Copy file name to clipboardExpand all lines: src/current/_includes/v25.2/misc/session-vars.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,7 @@
90
90
| <aid="transaction-timeout"></a> `transaction_timeout`| Aborts an explicit [transaction]({% link {{ page.version.version }}/transactions.md %}) when it runs longer than the configured duration. Stored in milliseconds; can be expressed in milliseconds or as an [`INTERVAL`]({% link {{ page.version.version }}/interval.md %}). |`0`| Yes | Yes |
91
91
| <aid="troubleshooting_mode_enabled"></a> `troubleshooting_mode_enabled`| When enabled, avoid performing additional work on queries, such as collecting and emitting telemetry data. This session variable is particularly useful when the cluster is experiencing issues, unavailability, or failure. |`off`| Yes | Yes |
92
92
| <aid="use_declarative_schema_changer"></a> `use_declarative_schema_changer`| Whether to use the declarative schema changer for supported statements. |`on`| Yes | Yes |
93
+
| <aid="vector-search-beam-size"></a> `vector_search_beam_size`| The size of the vector search beam, which determines how many vector partitions are considered during query execution. For details, refer to [Tune vector indexes]({% link {{ page.version.version }}/vector-indexes.md %}#tune-vector-indexes). |`32`| Yes | Yes |
93
94
| <aid="vectorize"></a> `vectorize`| The vectorized execution engine mode. Options include `on` and `off`. For more details, see [Configure vectorized execution for CockroachDB]({% link {{ page.version.version }}/vectorized-execution.md %}#configure-vectorized-execution). |`on`| Yes | Yes |
94
95
| <aid="virtual_cluster_name"></a> `virtual_cluster_name`| The name of the virtual cluster that the SQL client is connected to. | Session-dependent | No | Yes |
Large batch inserts of [`VECTOR`]({% link {{ page.version.version }}/vector.md %}) types can cause performance degradation. When inserting vectors, batching should be avoided. For an example, refer to [Create and query a vector index]({% link {{ page.version.version }}/vector-indexes.md %}#create-and-query-a-vector-index).
Copy file name to clipboardExpand all lines: src/current/v25.2/create-index.md
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -44,10 +44,11 @@ Parameter | Description
44
44
----------|------------
45
45
`UNIQUE` | Apply the [`UNIQUE` constraint]({% link {{ page.version.version }}/unique.md %}) to the indexed columns.<br><br>This causes the system to check for existing duplicate values on index creation. It also applies the `UNIQUE` constraint at the table level, so the system checks for duplicate values when inserting or updating data.
46
46
`INVERTED` | Create a [GIN index]({% link {{ page.version.version }}/inverted-indexes.md %}) on the schemaless data in the specified [`JSONB`]({% link {{ page.version.version }}/jsonb.md %}) column.<br><br> You can also use the PostgreSQL-compatible syntax `USING GIN`. For more details, see [GIN Indexes]({% link {{ page.version.version }}/inverted-indexes.md %}#creation).
47
+
`VECTOR` | Create a [vector index]({% link {{ page.version.version }}/vector-indexes.md %}) on the specifed [`VECTOR`]({% link {{ page.version.version }}/vector.md %}) column.<br><br>For more details, refer to [Vector Indexes]({% link {{ page.version.version }}/vector-indexes.md %}).
47
48
`IF NOT EXISTS` | Create a new index only if an index of the same name does not already exist; if one does exist, do not return an error.
48
49
`opt_index_name`<br>`index_name` | The name of the index to create, which must be unique to its table and follow these [identifier rules]({% link {{ page.version.version }}/keywords-and-identifiers.md %}#identifiers).<br><br>If you do not specify a name, CockroachDB uses the format `<table>_<columns>_key/idx`. `key` indicates the index applies the `UNIQUE` constraint; `idx` indicates it does not. Example: `accounts_balance_idx`
49
50
`table_name` | The name of the table you want to create the index on.
50
-
`USING name` | An optional clause for compatibility with third-party tools. Accepted values for `name` are `btree`, `gin`, and `gist`, with `btree` for a standard secondary index, `gin` as the PostgreSQL-compatible syntax for a [GIN index](#create-gin-indexes), and `gist` for a [spatial index]({% link {{ page.version.version }}/spatial-indexes.md %}).
51
+
`USING name` | An optional clause for compatibility with third-party tools. Accepted values for `name` are `btree`, `gin`, and `gist`, with `btree` for a standard secondary index, `gin` as the PostgreSQL-compatible syntax for a [GIN index](#create-gin-indexes), `gist` for a [spatial index]({% link {{ page.version.version }}/spatial-indexes.md %}), and `cspann` for a [vector index]({% link {{ page.version.version }}/vector-indexes.md %}). `hnsw` is aliased to `cspann` for compatibility with [`pgvector`](https://github.com/pgvector/pgvector) syntax.
51
52
`name` | The name of the column you want to index. For [multi-region tables]({% link {{ page.version.version }}/multiregion-overview.md %}#table-localities), you can use the `crdb_region` column within the index in the event the original index may contain non-unique entries across multiple, unique regions.
52
53
`ASC` or `DESC`| Sort the column in ascending (`ASC`) or descending (`DESC`) order in the index. How columns are sorted affects query results, particularly when using `LIMIT`.<br><br>__Default:__`ASC`
53
54
`STORING ...`| Store (but do not sort) each column whose name you include.<br><br>For information on when to use `STORING`, see [Store Columns](#store-columns). Note that columns that are part of a table's [`PRIMARY KEY`]({% link {{ page.version.version }}/primary-key.md %}) cannot be specified as `STORING` columns in secondary indexes on the table.<br><br>`COVERING` and `INCLUDE` are aliases for `STORING` and work identically.
@@ -175,6 +176,17 @@ CREATE INDEX geom_idx_2
175
176
Most users should not change the default spatial index settings. There is a risk that you will get worse performance by changing the default settings. For more information , see [Spatial indexes]({% link {{ page.version.version }}/spatial-indexes.md %}).
176
177
{{site.data.alerts.end}}
177
178
179
+
### Create vector indexes
180
+
181
+
{% include_cached new-in.html version="v25.2" %} You can create [vector indexes]({% link {{ page.version.version }}/vector-indexes.md %}) on [`VECTOR`]({% link {{ page.version.version }}/vector.md %}) columns.
182
+
183
+
To create a vector index on a `VECTOR` column named `embedding`:
184
+
185
+
{% include_cached copy-clipboard.html %}
186
+
~~~sql
187
+
CREATE VECTOR INDEX ON items (embedding);
188
+
~~~
189
+
178
190
### Store columns
179
191
180
192
Storing a column improves the performance of queries that retrieve (but do not filter) its values.
Copy file name to clipboardExpand all lines: src/current/v25.2/create-table.md
+53-20Lines changed: 53 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -259,7 +259,7 @@ For performance recommendations on primary keys, see the [Schema Design: Create
259
259
260
260
### Create a table with secondary and GIN indexes
261
261
262
-
In this example, we create secondary and GIN indexes during table creation. Secondary indexes allow efficient access to data with keys other than the primary key. [GIN indexes]({% link {{ page.version.version }}/inverted-indexes.md %}) allow efficient access to the schemaless data in a [`JSONB`]({% link {{ page.version.version }}/jsonb.md %}) column.
262
+
In this example, we create secondary and GIN indexes during table creation. [Secondary indexes]({% link {{ page.version.version }}/schema-design-indexes.md %}) allow efficient access to data with keys other than the primary key. [GIN indexes]({% link {{ page.version.version }}/inverted-indexes.md %}) allow efficient access to the schemaless data in a [`JSONB`]({% link {{ page.version.version }}/jsonb.md %}) column.
263
263
264
264
{% include_cached copy-clipboard.html %}
265
265
~~~sql
@@ -285,29 +285,61 @@ In this example, we create secondary and GIN indexes during table creation. Seco
vehicles | index_status | t| 1 | status | status | ASC | f | f | t | 1
291
+
vehicles | index_status | t| 2 | city | city | ASC | f | t | t | 1
292
+
vehicles | index_status | t| 3 | id | id | ASC | f | t | t | 1
293
+
vehicles | ix_vehicle_ext | t| 1 | ext | ext | ASC | f | f | t | 1
294
+
vehicles | ix_vehicle_ext | t| 2 | city | city | ASC | f | t | t | 1
295
+
vehicles | ix_vehicle_ext | t| 3 | id | id | ASC | f | t | t | 1
296
+
vehicles | primary | f | 1 | city | city | ASC | f | f | t | 1
297
+
vehicles | primary | f | 2 | id | id | ASC | f | f | t | 1
298
+
vehicles | primary | f | 3 | type | type | N/A | t | f | t | 1
299
+
vehicles | primary | f | 4 | owner_id | owner_id | N/A | t | f | t | 1
300
+
vehicles | primary | f | 5 | creation_time | creation_time | N/A | t | f | t | 1
301
+
vehicles | primary | f | 6 | status | status | N/A | t | f | t | 1
302
+
vehicles | primary | f | 7 | current_location | current_location | N/A | t | f | t | 1
303
+
vehicles | primary | f | 8 | ext | ext | N/A | t | f | t | 1
304
304
(14 rows)
305
305
~~~
306
306
307
-
We also have other resources on indexes:
307
+
### Create a table with a vector index
308
308
309
-
- Create indexes for existing tables using [`CREATE INDEX`]({% link {{ page.version.version }}/create-index.md %}).
310
-
-[Learn more about indexes]({% link {{ page.version.version }}/indexes.md %}).
309
+
Enable vector indexes:
310
+
311
+
{% include_cached copy-clipboard.html %}
312
+
~~~sql
313
+
SET CLUSTER SETTING feature.vector_index.enabled = true;
314
+
~~~
315
+
316
+
The following statement creates a table with a [`VECTOR`]({% link {{ page.version.version }}/vector.md %}) column, along with a [vector index]({% link {{ page.version.version }}/vector-indexes.md %}) that makes vector search efficient.
0 commit comments