Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server 2025 (17.x)
Azure SQL Database
Azure SQL Managed Instance
SQL database in Microsoft Fabric
Contains a row per json index.
| Column name | Data type | Description |
|---|---|---|
| <inherited columns> | Inherits columns from sys.indexes. | |
| optimize_for_array_search | bit | Indicates that array search optimization is enabled for JSON index. 1 = Array search optimization is enabled for JSON index. 0 = Array search optimization isn't enabled for JSON indexes. Default is 0. |
Permissions
The visibility of the metadata in catalog views is limited to securables that a user either owns, or on which the user was granted some permission. For more information, see Metadata visibility configuration.
Examples
A. JSON index without array search optimization
The following example returns JSON indexes for the table dbo.Customers. The JSON index is created without the array search optimization option enabled.
DROP TABLE IF EXISTS dbo.Customers;
CREATE TABLE dbo.Customers
(
customer_id INT IDENTITY PRIMARY KEY,
customer_info JSON NOT NULL
);
CREATE JSON INDEX CustomersJsonIndex
ON dbo.Customers (customer_info);
INSERT INTO dbo.Customers (customer_info)
VALUES ('{"name":"customer1", "email": "customer1@example.com", "phone":["123-456-7890", "234-567-8901"]}');
SELECT object_id,
index_id,
optimize_for_array_search
FROM sys.json_indexes AS ji
WHERE object_id = OBJECT_ID('dbo.Customers');
B. JSON index with array search optimization
The following example returns JSON indexes for the table dbo.Customers. The JSON index is created with the array search optimization option enabled.
DROP TABLE IF EXISTS dbo.Customers;
CREATE TABLE dbo.Customers
(
customer_id INT IDENTITY PRIMARY KEY,
customer_info JSON NOT NULL
);
CREATE JSON INDEX CustomersJsonIndex
ON dbo.Customers (customer_info) WITH (OPTIMIZE_FOR_ARRAY_SEARCH = ON);
INSERT INTO dbo.Customers (customer_info)
VALUES ('{"name":"customer1", "email": "customer1@example.com", "phone":["123-456-7890", "234-567-8901"]}');
SELECT object_id,
index_id,
optimize_for_array_search
FROM sys.json_indexes AS ji
WHERE object_id = OBJECT_ID('dbo.Customers');