PersistentIndexOptions extends IndexOptions
The options of a persistent index.
Table of Contents
Constants
- CACHE_ENABLED : string = 'cacheEnabled'
- DEDUPLICATE : string = 'deduplicate'
- ESTIMATES : string = 'estimates'
- EXPIRE_AFTER : string = 'expireAfter'
- FIELD_VALUE_TYPES : string = 'fieldValueTypes'
- FIELDS : string = 'fields'
- GEO_JSON : string = 'geoJson'
- IN_BACKGROUND : string = 'inBackground'
- LEGACY_POLYGONS : string = 'legacyPolygons'
- NAME : string = 'name'
- PARALLELISM : string = 'parallelism'
- PARAMS : string = 'params'
- PREFIX_FIELDS : string = 'prefixFields'
- SPARSE : string = 'sparse'
- STORED_VALUE : string = 'storedValue'
- TYPE : string = 'type'
- UNIQUE : string = 'unique'
Properties
- $cacheEnabled : bool
- This attribute controls whether an extra in-memory hash cache is created for the index.
- $deduplicate : bool
- The optional deduplicate attribute is supported by persistent array indexes.
- $estimates : bool
- This attribute controls whether index selectivity estimates are maintained for the index.
- $fields : array<string|int, mixed>
- An array of attribute paths, containing the document attributes (or sub-attributes) to be indexed.
- $inBackground : bool
- Set this option to true to keep the collection/shards available for write operations by not using an exclusive write lock for the duration of the index creation.
- $name : string
- An easy-to-remember name for the index to look it up or refer to it in index hints.
- $sparse : bool
- Can be true or false.
- $storedValues : array<string|int, mixed>|null
- The optional storedValues attribute can contain an array of paths to additional attributes to store in the index.
- $type : string
- Can be one of the following values: - "persistent": persistent (array) index, including vertex-centric index - "inverted": inverted index - "ttl": time-to-live index - "fulltext": full-text index (deprecated from ArangoDB 3.10 onwards) - "geo": geo-spatial index, with one or two attributes - "mdi": multi-dimensional index - "mdi-prefixed": multi-dimensional index with search prefix, including vertex-centric index
- $unique : bool
- Whether to create the index with a uniqueness constraint.
Methods
- __construct() : mixed
- Creates a new IndexOptions instance.
- jsonSerialize() : array<string|int, mixed>
- Invoked to serialize the object with the json serializer.
Constants
CACHE_ENABLED
public
string
CACHE_ENABLED
= 'cacheEnabled'
DEDUPLICATE
public
string
DEDUPLICATE
= 'deduplicate'
ESTIMATES
public
string
ESTIMATES
= 'estimates'
EXPIRE_AFTER
public
string
EXPIRE_AFTER
= 'expireAfter'
FIELD_VALUE_TYPES
public
string
FIELD_VALUE_TYPES
= 'fieldValueTypes'
FIELDS
public
string
FIELDS
= 'fields'
GEO_JSON
public
string
GEO_JSON
= 'geoJson'
IN_BACKGROUND
public
string
IN_BACKGROUND
= 'inBackground'
LEGACY_POLYGONS
public
string
LEGACY_POLYGONS
= 'legacyPolygons'
NAME
public
string
NAME
= 'name'
PARALLELISM
public
string
PARALLELISM
= 'parallelism'
PARAMS
public
string
PARAMS
= 'params'
PREFIX_FIELDS
public
string
PREFIX_FIELDS
= 'prefixFields'
SPARSE
public
string
SPARSE
= 'sparse'
STORED_VALUE
public
string
STORED_VALUE
= 'storedValue'
TYPE
public
string
TYPE
= 'type'
UNIQUE
public
string
UNIQUE
= 'unique'
Properties
$cacheEnabled
This attribute controls whether an extra in-memory hash cache is created for the index.
public
bool
$cacheEnabled
= false
The hash cache can be used to speed up index lookups. The cache can only be used for queries that look up all index attributes via an equality lookup (==). The hash cache cannot be used for range scans, partial lookups or sorting.
The cache will be populated lazily upon reading data from the index. Writing data into the collection or updating existing data will invalidate entries in the cache. The cache may have a negative effect on performance in case index values are updated more often than they are read.
The maximum size of cache entries that can be stored is currently 4 MB, i.e. the cumulated size of all index entries for any index lookup value must be less than 4 MB. This limitation is there to avoid storing the index entries of “super nodes” in the cache.
cacheEnabled defaults to false and should only be used for indexes that are known to benefit from an extra layer of caching.
$deduplicate
The optional deduplicate attribute is supported by persistent array indexes.
public
bool
$deduplicate
= true
It controls whether inserting duplicate index values from the same document into a unique array index will lead to a unique constraint error or not.
The default value is true, so only a single instance of each non-unique index value will be inserted into the index per document.
Trying to insert a value into the index that already exists in the index always fails, regardless of the value of this attribute.
$estimates
This attribute controls whether index selectivity estimates are maintained for the index.
public
bool
$estimates
= true
Not maintaining index selectivity estimates can have a slightly positive impact on write performance.
The downside of turning off index selectivity estimates is that the query optimizer is not able to determine the usefulness of different competing indexes in AQL queries when there are multiple candidate indexes to choose from.
The option has no effect on indexes other than persistent, mdi, and mdi-prefixed.
$fields
An array of attribute paths, containing the document attributes (or sub-attributes) to be indexed.
public
array<string|int, mixed>
$fields
= []
Some indexes allow using only a single path, and others allow multiple. If multiple attributes are used, their order matters.
The '.' character denotes sub-attributes in attribute paths.
Attributes with literal '.' in their name cannot be indexed. Attributes with the name _id cannot be indexed either, neither as a top-level attribute nor as a sub-attribute (except the inverted index type).
If an attribute path contains an [] extension (e.g. friends[].id), it means that the index attribute value is treated as an array and all array members are indexed separately.
This is possible with persistent and inverted indexes.
Tags
$inBackground
Set this option to true to keep the collection/shards available for write operations by not using an exclusive write lock for the duration of the index creation.
public
bool
$inBackground
= false
$name
An easy-to-remember name for the index to look it up or refer to it in index hints.
public
string
$name
Index names are subject to the same character restrictions as collection names.
If omitted, a name is auto-generated so that it is unique with respect to the collection, e.g. idx_832910498.
$sparse
Can be true or false.
public
bool
$sparse
= false
You can control the sparsity for persistent, mdi, and mdi-prefixed indexes.
The inverted, fulltext, and geo index types are sparse by definition.
$storedValues
The optional storedValues attribute can contain an array of paths to additional attributes to store in the index.
public
array<string|int, mixed>|null
$storedValues
These additional attributes cannot be used for index lookups or for sorting, but they can be used for projections. This allows an index to fully cover more queries and avoid extra document lookups.
The maximum number of attributes in storedValues is 32.
It is not possible to create multiple indexes with the same fields attributes and uniqueness but different storedValues attributes. That means the value of storedValues is not considered by index creation calls when checking if an index is already present or needs to be created.
In unique indexes, only the attributes in fields are checked for uniqueness, but the attributes in storedValues are not checked for their uniqueness.
Non-existing attributes are stored as null values inside storedValues.
$type
Can be one of the following values: - "persistent": persistent (array) index, including vertex-centric index - "inverted": inverted index - "ttl": time-to-live index - "fulltext": full-text index (deprecated from ArangoDB 3.10 onwards) - "geo": geo-spatial index, with one or two attributes - "mdi": multi-dimensional index - "mdi-prefixed": multi-dimensional index with search prefix, including vertex-centric index
public
string
$type
= \oihana\arango\db\enums\IndexType::PERSISTENT
$unique
Whether to create the index with a uniqueness constraint.
public
bool
$unique
= false
In unique indexes, only the attributes in fields are checked for uniqueness, but the attributes in storedValues are not checked for their uniqueness.
Methods
__construct()
Creates a new IndexOptions instance.
public
__construct([array<string|int, mixed>|object|null $init = null ]) : mixed
Parameters
- $init : array<string|int, mixed>|object|null = null
-
A generic object containing properties with which to populate the newly instance. If this argument is null, it is ignored.
jsonSerialize()
Invoked to serialize the object with the json serializer.
public
jsonSerialize() : array<string|int, mixed>