This topic describes the ST_SetTypeStorage function, which is used to set the storage mode for specific data types. This function allows you to store some types of data in-row and store the other types of data off-row.

Syntax

bool ST_SetTypeStorage(cstring typeName, cstring storageStrategy, integer size);

Parameters

Parameter Description
typeName The types of data whose storage mode you want to specify. The supported data types include geometry and geography.
storageStrategy The storage mode that you want to specify. Set the value to main.
size The number of bytes that can be stored in-row.

Description

If the size per object for a specific data type is large, you can store the metadata in-row and store the entity data off-row. For normal query and analysis workloads, PolarDB needs to read only the in-row metadata. This reduces the I/O operations on the disk.

The size parameter specifies the number of in-row bytes. If you set this parameter to 0, data is still stored in main mode. The following table lists the recommended values of this parameter for various data types.

Data type Dimension Recommended value
geometry 2d(x,y) 24
3d(x,y,z) and 3dm(x,y,m) 32
4d(x,y,z,m) 40
geography 2d(x,y) 32

Example

Select ST_SetTypeStorage('geometry','main', 41);
 st_settypestorage 
-------------------
 t
(1 row)