Skip to main content
The WITH (storage parameter) sets a storage parameter on a table.

Syntax

create_index_with_storage_param::= create_index_with_storage_param syntax diagram create_table_with_storage_param::= create_table_with_storage_param syntax diagram

Command parameters

ParameterDescription
tableThe table to which you are setting the parameter.
indexThe index to which you are setting the parameter.
parameter\_nameThe name of the storage parameter. See Storage parameters for a list of available parameters.

Storage parameters

Index parameters

Parameter nameDescriptionData typeDefault value
bucket\_countThe number of buckets into which a will split.IntegerThe value of the sql.defaults.default\_hash\_sharded\_index\_bucket\_count.
geometry\_max\_xThe maximum X-value of the for the object(s) being covered. This only needs to be set if you are using a custom .Derived from SRID bounds, else (1 << 31) -1.
geometry\_max\_yThe maximum Y-value of the for the object(s) being covered. This only needs to be set if you are using a custom .Derived from SRID bounds, else (1 << 31) -1.
geometry\_min\_xThe minimum X-value of the for the object(s) being covered. This only needs to be set if the default bounds of the SRID are too large/small for the given data, or SRID = 0 and you wish to use a smaller range (unfortunately this is currently not exposed, but is viewable on https://epsg.io/3857). By default, SRID = 0 assumes [-min int32, max int32] ranges.Derived from SRID bounds, else -(1 << 31).
geometry\_min\_yThe minimum Y-value of the for the object(s) being covered. This only needs to be set if you are using a custom .Derived from SRID bounds, else -(1 << 31).
s2\_level\_mods2\_max\_level must be divisible by s2\_level\_mod. s2\_level\_mod must be between 1 and 3.Integer1
s2\_max\_cellsThe maximum number of S2 cells used in the covering. Provides a limit on how much work is done exploring the possible coverings. Allowed values: 1-30. You may want to use higher values for odd-shaped regions such as skinny rectangles. Used in .Integer4
s2\_max\_levelThe maximum level of S2 cell used in the covering. Allowed values: 1-30. Setting it to less than the default means that CockroachDB will be forced to generate coverings using larger cells. Used in .Integer30
The following parameters are included for PostgreSQL compatibility and do not affect how CockroachDB runs:
  • fillfactor

Table parameters

Parameter nameDescriptionData typeDefault value
exclude\_data\_from\_backupExclude the data in this table from any future backups.Booleanfalse
New in v23.2.1:schema\_lockedDisallow on this table. Enabling schema\_locked can help running on this table.Booleanfalse
sql\_stats\_automatic\_collection\_enabledEnable automatic collection of for this table.Booleantrue
sql\_stats\_automatic\_collection\_min\_stale\_rowsMinimum number of stale rows in this table that will trigger a statistics refresh.Integer500
sql\_stats\_automatic\_collection\_fraction\_stale\_rowsFraction of stale rows in this table that will trigger a statistics refresh.Float0.2
sql\_stats\_forecasts\_enabledEnable collection for this table.Booleantrue
The following parameters are included for PostgreSQL compatibility and do not affect how CockroachDB runs:
  • autovacuum_enabled
  • fillfactor
For the list of storage parameters that affect how works, see the list of .

Required privileges

The user must be a member of the or roles, or have the on the table.

Examples

Create a table with row-level TTL enabled

In this case, CockroachDB implicitly added the ttl and ttl_job_cron .

See also