MaxCompute tiered storage includes standard storage, low-frequency storage, and long-term storage. By default, data is stored in standard storage. Based on data access frequency, you can change the storage type of specific tables or partitions to low-frequency storage or long-term storage. This practice, known as hot/cold data separation, helps you reduce storage fees.
Tiered storage types
|
Type |
Description |
|
standard storage |
The default storage type. It is suitable for frequently accessed data that requires frequent read and write operations. |
|
low-frequency storage |
Suitable for infrequently accessed data. This helps you effectively reduce storage fees. Note
|
|
long-term storage |
Billing
-
For more information about storage billing, see Storage fee.
-
When using low-frequency storage or long-term storage, consider the data access volume and frequency. High-volume or frequent access can cost more than using standard storage.
-
The cost of performing a full table scan on a table or partition in low-frequency storage once a month is equivalent to the cost of keeping it in standard storage.
-
The cost of performing a full table scan on a table or partition in long-term storage once every six months is equivalent to the cost of keeping it in standard storage.
-
-
Log on to the Billing Management console. On the page, you can view the fees for different storage types. The billable items for standard storage, low-frequency storage, and long-term storage are named Storage, Tiered Storage-Low-Frequency, and Long-Term Storage, respectively. For detailed instructions, see View bill details.
Usage notes
-
Region availability: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Ulanqab), China (Shenzhen), China (Chengdu), China (Hong Kong), China (Shanghai) Finance, China (Beijing) Finance, China (Shenzhen) Finance, Singapore, Malaysia (Kuala Lumpur), Indonesia (Jakarta), Japan (Tokyo), Germany (Frankfurt), and US (Silicon Valley).
-
Currently, data in low-frequency and long-term storage cannot be directly accessed by Hologres. In addition, when Hologres directly reads from MaxCompute, the
last_access_timeof the MaxCompute table or partition is not updated. Therefore, when you set a tiered storage lifecycle rule that uses thelast_access_timecondition, some tables or partitions that are continuously read only by Hologres may also match the rule.
Configure storage types
You can transition data between different storage types. Modifying the storage type does not affect data access.
The following table describes the storage type transitions.
|
Transition |
Description |
|
standard storage -> low-frequency storage |
Both manual and automatic transitions are supported. No I/O access fee is incurred. The "Last Modified Time" and "Last Access Time" of the table or partition are not updated. |
|
standard storage -> long-term storage |
|
|
low-frequency storage -> long-term storage |
Both manual and automatic transitions are supported. Manual transitions incur an I/O access fee, while automatic transitions do not. The "Last Modified Time" and "Last Access Time" of the table or partition are not updated. |
|
low-frequency storage -> standard storage |
Only manual transitions are supported. An I/O access fee is incurred. The "Last Modified Time" and "Last Access Time" of the table or partition are updated. |
|
long-term storage -> low-frequency storage |
|
|
long-term storage -> standard storage |
Manual configuration
You can manually set the storage type for a non-partitioned table or a partition to low-frequency or long-term storage. The change takes effect immediately.
Command format
ALTER TABLE <TABLE_NAME> [PARTITION(<PARTITION_SPEC>)]
SET <TBLPROPERTIES|PARTITIONPROPERTIES>("storagetier"="standard|lowfrequency|longterm");
Parameters
-
TABLE_NAME: Required. The name of the table whose storage type you want to modify, or the name of the partitioned table that contains the target partition.
-
PARTITION_SPEC: Required if you are modifying the storage type of a partition.
-
TBLPROPERTIES|PARTITIONPROPERTIES: Specifies whether to modify the storage type of a table or a partition.
-
TBLPROPERTIES: Modifies the storage type of a table.
-
PARTITIONPROPERTIES: Modifies the storage type of a partition.
-
-
storagetier: Required. The tiered storage type. Valid values:
-
standard: standard storage. Only storage fees are charged.
-
lowfrequency: low-frequency storage. Both storage fees and data access fees for low-frequency storage are charged.
-
longterm: long-term storage. Both storage fees and data access fees for long-term storage are charged.
-
You can set the tiered storage type only for partitions within a partitioned table. You cannot set the tiered storage type for an entire partitioned table.
Examples
-
Example 1: Set the storage type of a non-partitioned table to low-frequency storage.
ALTER TABLE tablename SET TBLPROPERTIES("storagetier"="lowfrequency");View the table properties. You can check the
StorageTierfield to confirm the current storage type.--View table properties DESC extended tablename; ---Sample output +-------------------------------------------------------------------+ | Owner: ALIYUN$mofan_****@test.aliyunid.com | | Project: mf_mc_**** | | TableComment: | +-------------------------------------------------------------------+ | CreateTime: 2021-11-18 15:14:00 | | LastDDLTime: 2023-09-11 14:34:55 | | LastModifiedTime: 2023-09-13 15:02:28 | | LastAccessTime: 2023-09-14 10:50:57 | +-------------------------------------------------------------------+ | InternalTable: YES | Size: 1923683131 | +-------------------------------------------------------------------+ | Native Columns: | +-------------------------------------------------------------------+ | Field| Type| Label |ExtendedLabel| Nullable| DefaultValue|Comment | +-------------------------------------------------------------------+ | empno | bigint | | | true | NULL | | | ename | string | | | true | NULL | | | job | string | | | true | NULL | | | mgr | bigint | | | true | NULL | | | hiredate | datetime | | | true | NULL | | | sal | bigint | | | true | NULL | | | comm | bigint | | | true | NULL | | | deptno | bigint | | | true | NULL | | +-------------------------------------------------------------------+ | Extended Info: | +-------------------------------------------------------------------+ | TableID: 8e0cc78c81ab4ad7af30bff7a8e**** | | IsArchived: false | | PhysicalSize: 5771049393 | | FileNum: 3 | | StoredAs: AliOrc | | CompressionStrategy: normal | | odps.timemachine.retention.days: 1 | | ColdStorageStatus: N/A | | encryption_enable: false | | StorageTier: lowfrequency | | StorageTierLastModifiedTime: 2023-09-11 14:34:55 | +-------------------------------------------------------------------+ -
Example 2: Set the storage type of a partition in the partitioned table bank_data_pt to low-frequency storage.
ALTER TABLE bank_data_pt PARTITION (credit='yes') SET PARTITIONPROPERTIES ("storagetier" = 'lowfrequency');You can check the
StorageTierfield in the partition properties to determine the current storage type.--View partition properties DESC extended bank_data_pt PARTITION(credit='yes'); --Sample output +------------------------------------------------------------------------------------+ | PartitionSize: 0 | +------------------------------------------------------------------------------------+ | CreateTime: 2024-05-10 10:28:16 | | LastDDLTime: 2024-05-10 10:31:01 | | LastModifiedTime: 2024-05-10 10:28:16 | +------------------------------------------------------------------------------------+ | IsExstore: false | | IsArchived: false | | PhysicalSize: 0 | | FileNum: 0 | | ColdStorageStatus: N/A | | StorageTier: lowfrequency | | StorageTierLastModifiedTime: 2024-05-10 10:31:01 | +------------------------------------------------------------------------------------+
Automated configuration
You can configure lifecycle rules for tiered storage at the project or partitioned table level to automate storage type transitions.
-
Project-level configuration:
A project-level rule serves as the default for all non-partitioned tables and for partitions in tables that do not have specific rules. Matching tables and partitions are automatically transitioned.
-
Partitioned table-level configuration:
A rule set for a specific partitioned table takes precedence over any project-level rule. When any partition in this table meets the rule's criteria, the partition is automatically transitioned to the corresponding storage type.
Key limitations
Rules cannot be configured at a more granular level:
-
You cannot set an independent rule for a single non-partitioned table. It inherits the project-level rule.
-
You cannot set an independent rule for a specific partition within a partitioned table. It inherits the rule of its parent partitioned table.
Rule execution
-
If a table or partition meets the lifecycle criteria for both long-term storage (longterm) and low-frequency storage (lowfrequency), it is converted to
longtermwith priority. -
If a table or partition first meets the
lowfrequencylifecycle rule, it is converted tolowfrequency. If it later meets thelongtermrule, it is converted tolongterm. In this case, the conversion fromlowfrequencytolongtermdoes not incur alowfrequencyaccess fee. For billing details, see Tiered Storage Billing. -
The platform scans for rule compliance twice a day. Therefore, there may be a delay between when a table or partition meets the conditions and when the transition occurs.
Command format
-
Set a lifecycle rule at the project level
SETPROJECT odps.table.lifecycle.config=<lifecycle_config_json_string>;You can also configure this in the MaxCompute console:
-
Log in to the MaxCompute console and select a region in the upper-left corner.
-
In the left-side navigation pane, choose .
-
On the Projects page, click Manage in the Actions column for the target project.
-
On the Project Settings page, click the Parameter Configuration tab.
-
In the Lifecycle Configuration section, click Edit.
-
Configure the Last Access Configuration Policy and Last Modified Configuration Policy parameters.
-
Last Access Configuration Policy: Corresponds to the
DaysAfterLastAccessGreaterThanparameter. -
Last Modified Configuration Policy: Corresponds to the
DaysAfterLastModificationGreaterThanparameter.
-
-
-
Set a lifecycle rule for a partitioned table
-
Set during table creation:
CREATE [EXTERNAL] TABLE [IF NOT EXISTS] <table_name> [PRIMARY KEY (<pk_col_name>, <pk_col_name2>),(<col_name> <data_type> [NOT NULL] [DEFAULT <default_value>] [comment <col_comment>], ...)] PARTITIONED BY (<col_name> <data_type> [comment <col_comment>], ...) tblproperties ('lifecycle_config' = '<lifecycle_config_json_string>') ; -
Modify an existing table:
ALTER TABLE <TABLE_NAME> SET TBLPROPERTIES ('lifecycle_config' = '<lifecycle_config_json_string>');
-
-
View the tiered storage lifecycle configuration of a partitioned table
SHOW CREATE TABLE <table_name>;
Parameters
The following table describes the key parameters. For information about other parameters, see Common parameters.
lifecycle_config_json_string:
-
When setting a lifecycle rule at the project level, the definition is as follows.
{ "TierToLowFrequency": { "DaysAfterLastModificationGreaterThan": <days>, // Transition if days since last modification exceeds this value. "DaysAfterLastAccessGreaterThan": <days>, // Transition if days since last access exceeds this value. }, "TierToLongterm": { "DaysAfterLastModificationGreaterThan": <days>, "DaysAfterLastAccessGreaterThan": <days> } // Each condition is optional. Multiple conditions are combined with an OR relationship. } -
When setting a lifecycle rule for a partitioned table, the definition is as follows.
{ \"TierToLowFrequency\": { \"DaysAfterLastModificationGreaterThan\": <days>, // Transition if days since last modification exceeds this value. \"DaysAfterLastAccessGreaterThan\": <days>, // Transition if days since last access exceeds this value. }, \"TierToLongterm\": { \"DaysAfterLastModificationGreaterThan\": <days>, \"DaysAfterLastAccessGreaterThan\": <days> } // Each condition is optional. Multiple conditions are combined with an OR relationship. } -
TierToLowFrequency: Identifier for low-frequency storage.
-
TierToLongterm: Identifier for long-term storage.
-
DaysAfterLastModificationGreaterThan: The number of days after the last modification time (LastModifiedTime) before the data is automatically transitioned.
-
DaysAfterLastAccessGreaterThan: The number of days after the last access time (LastAccessTime) before the data is automatically transitioned. If the LastAccessTime of a table or partition is empty, the following rules apply:
-
For tables or partitions created before October 1, 2023, the time is calculated by default based on the UTC+0 time zone, such as
2023.10.01 00:00:00. -
For tables or partitions created on or after October 1, 2023, if the data has never been accessed, the calculation is based on its creation time (CreateTime).
-
Examples
-
Example 1: Set a lifecycle rule at the project level.
setproject odps.table.lifecycle.config={"TierToLongterm":{"DaysAfterLastAccessGreaterThan":180},"TierToLowFrequency":{"DaysAfterLastAccessGreaterThan":120}}; -
Example 2: Remove a project-level lifecycle configuration.
setproject odps.table.lifecycle.config=; -
Example 3: Set a lifecycle rule for a partitioned table.
-- Set during table creation CREATE TABLE lifecycle_part_t (key string) PARTITIONED BY (ds STRING) tblproperties ('lifecycle_config' = '{\"TierToLowFrequency\": {\"DaysAfterLastModificationGreaterThan\": 2,\"DaysAfterLastAccessGreaterThan\": 2},\"TierToLongterm\": {\"DaysAfterLastModificationGreaterThan\": 4,\"DaysAfterLastAccessGreaterThan\": 7}}') ; -- Modify an existing table ALTER TABLE lifecycle_part_t SET tblproperties ('lifecycle_config'='{\"TierToLowFrequency\": {\"DaysAfterLastModificationGreaterThan\": 90,\"DaysAfterLastAccessGreaterThan\": 30},\"TierToLongterm\": {\"DaysAfterLastModificationGreaterThan\": 180,\"DaysAfterLastAccessGreaterThan\": 7}}'); -
Example 4: Remove the tiered storage lifecycle configuration from a partitioned table.
ALTER TABLE lifecycle_part_t SET tblproperties ('lifecycle_config'='{}');
Table-level access control
After a table or partition is moved to low-frequency storage or long-term storage, accessing its data incurs a data access fee.
By default, any user with SELECT permission on a table can access its data, regardless of the storage type. MaxCompute provides separate table-level access controls for low-frequency and long-term storage. When this feature is enabled, SELECT permission only grants access to standard storage data. Accessing data in low-frequency or long-term storage requires additional, explicit permissions for those storage types. This helps prevent unintended access to cold data and avoids unexpected cost overruns.
Compared to filtering partition data with row-level access control, which silently filters out unauthorized partitions, this method causes a query to fail immediately if it attempts to access a cold partition without permission. This prevents calculation results from being unexpectedly inaccurate due to missing data.
Permission model
-
Global switch: This feature can be enabled or disabled at the tenant level and is disabled by default. When disabled, the behavior matches the existing model, where SELECT permission is sufficient to access data in all storage types.
-
Permission granularity: Permissions are controlled at the table level. When you grant permissions on a partitioned table, they apply to all partitions within that table.
-
Authorization policy: After the switch is enabled, accessing data in low-frequency or long-term storage requires both SELECT permission on the table and the corresponding access permission for the storage type. Access to standard storage data is not affected.
|
Object |
Actions |
Description |
Authorization method |
|
Table |
ReadLowfrequencyStorage |
Allows reading data from a table or partition in low-frequency storage ( |
ACL, Policy |
|
Table |
ReadLongtermStorage |
Allows reading data from a table or partition in long-term storage ( |
ACL, Policy |
Permission combinations
The following table shows the access results for a user with SELECT permission on a table after the access control switch is enabled.
|
Existing permissions |
Standard storage |
Low-frequency storage |
Long-term storage |
|
SELECT |
Allowed |
Denied |
Denied |
|
SELECT + ReadLowfrequencyStorage |
Allowed |
Allowed |
Denied |
|
SELECT + ReadLongtermStorage |
Allowed |
Denied |
Allowed |
|
SELECT + ReadLowfrequencyStorage + ReadLongtermStorage |
Allowed |
Allowed |
Allowed |
Limitations
-
The switch is tenant-level. Once enabled, it affects all projects and all tables and partitions that are already in low-frequency or long-term storage within the tenant. Before enabling the switch, review and grant the necessary permissions for existing jobs to avoid service disruptions.
-
Table Owners, Project Owners, Schema Owners, and users with the Super_Administrator or Admin role have the required permissions by default and do not need to be granted additional permissions. They can also grant these permissions to other users or roles.
-
These permissions only control the reading of cold data. To transition a table or partition from low-frequency or long-term storage back to standard storage, the user still needs ALTER permission on the table.
-
For projects that have Schema syntax enabled (three-tier model), you must enable the three-tier syntax at the session level before you perform authorization and query operations:
SET odps.namespace.schema=true;.
Procedure
Prerequisites
The tenant-level access control switch for tiered storage is enabled. To do this, follow these steps:
-
Log in to the MaxCompute console and select a region in the upper-left corner.
-
In the left-side navigation pane, choose .
-
On the Tenant Property tab, enable the Tenant-level Schema Syntax switch.
Note: After you enable the switch, users with only SELECT permission will no longer be able to access data in low-frequency or long-term storage. Grant the necessary permissions in advance to prevent existing jobs from failing.
Step 1: Check storage type
The StorageTier field in the table or partition properties specifies the current storage type. Only data stored in low-frequency (lowfrequency) or long-term (longterm) tiers is subject to permission constraints.
-- View table properties
DESC EXTENDED <table_name>;
-- View partition properties
DESC EXTENDED <table_name> PARTITION(<partition_spec>);
Step 2: Grant access permissions
Method 1: ACL authorization
Use this method for precise authorization on a single table. You can grant permissions to a user or a role.
-
Command format
GRANT ReadLowfrequencyStorage|ReadLongtermStorage ON TABLE <table_name> TO USER <user_name>|ROLE <role_name>; -
Parameters
Parameter
Required
Description
table_name
Yes
The name of the table to be authorized. For a partitioned table, granting permission at the table level applies to all its partitions.
user_name
Choose one
The authorized user is a RAM role user in the format
RAM$<AccountName>:role/<RamRoleName>, which must be enclosed in single quotes orbackticks.role_name
Choose one
The role to which permissions are granted. The role must be created and assigned to the target user beforehand.
-
Examples
-- Example 1: Grant a user permission to read the low-frequency storage table storage_table_lowfreq. GRANT ReadLowfrequencyStorage ON TABLE table_name TO USER 'RAM$example:role/data_reader'; -- Example 2: Grant read permissions through a role. -- Create a role named data_role and assign it to a user. CREATE ROLE data_role; GRANT data_role TO `RAM$example:role/data_reader`; -- Grant the role permission to read data in low-frequency and long-term storage. GRANT ReadLowfrequencyStorage ON TABLE table_name TO ROLE data_role; GRANT ReadLongtermStorage ON TABLE table_name TO ROLE data_role;
Method 2: Policy authorization
Use this method for bulk authorization. It supports matching multiple tables using wildcards or regular expressions and can only grant permissions to roles.
-
Configure through the console
-
Log in to the MaxCompute console and select a region in the upper-left corner.
-
In the left-side navigation pane, choose .
-
On the Projects page, click Manage in the Actions column for the target project.
-
On the Project Settings page, click the Role Permissions tab and modify the authorization for the target role.
-
Set Authorization Model to Policy, enter the policy content in the Document field, and submit.
Policy example: Grants a role the permission to read the low-frequency storage data of all tables that start with
storage_table_lowfreq.{ "Statement": [ { "Action": [ "odps:ReadLowfrequencyStorage" ], "Effect": "Allow", "Resource": [ "acs:odps:*:projects/<project_name>/tables/storage_table_lowfreq*" ] } ], "Version": "1" }
-
-
Configure using SQL commands
-- Create a role named data_role and assign it to a user. CREATE ROLE data_role; GRANT data_role TO `RAM$example:role/data_reader`; -- Allow the data_role to read long-term storage data from all tables prefixed with storage_table_longterm. GRANT ReadLongtermStorage ON TABLE table_name_* TO ROLE data_role PRIVILEGEPROPERTIES("policy" = "true", "allow" = "true");
Step 3: Verify permissions
Use the authorized account to run the following commands to check if the permissions have taken effect, and then access the target data to verify.
-- View the current user's permissions. ACL and Policy authorizations are displayed in their respective Authorization Type sections.
SHOW GRANTS;
-- Access data in low-frequency or long-term storage.
SELECT * FROM table_name;
If the authorization is effective, the query returns results. If not, an error is reported with the following message:
FAILED: ODPS-0130013:Authorization exception - Authorization failed [4009, 4019], You have no privilege 'odps:ReadLowfrequencyStorage' on {acs:odps:*:projects/<project_name>/tables/<table_name>}
FAQ
Restore previous access behavior
To restore the original behavior, simply disable the tenant-level tiered storage access control switch. After disabling it, users with SELECT permission will be able to access data in all storage types. Any permissions already granted will not be affected.
Filtering partition data
Accessing data that has been set to low-frequency or long-term storage incurs an access fee. You can use the row-level access control feature along with the GET_PARTITION_META function to control permissions for data in low-frequency or long-term storage to manage access to this data.
GET_PARTITION_META
GET_PARTITION_META is a special function that can only be used with row-level access control. It cannot be used in standard SQL queries.
Syntax
struct GET_PARTITION_META(<tableName>, <pt_col1>, <pt_col2>, ..., <pt_col_n>);
Parameters
|
Parameter |
Description |
|
tableName |
The name of the table, which must be a partitioned table. The value is of the String type and supports the |
|
pt_col |
Each parameter from pt_col1 to pt_col_n corresponds to a partition level of the partitioned table. Each parameter must be a column reference. |
Return value
Returns a Struct of the type struct<storagetier:string>. The struct contains a single String field that describes the storage type of the corresponding partition.
Usage notes
-
When adding a row-level policy to a table, consider the access behavior of users other than those being controlled. If the table is already being accessed by other users, you should set explicit policies for them to avoid data filtering issues caused by unintended access denial. For more information, see row-level access control.
-
By default, MaxCompute tables can be accessed not only through SQL but also by external engines like Spark and Flink. However, only the MaxCompute SQL engine currently supports the GET_PARTITION_META function. Therefore, if you use GET_PARTITION_META in a row-level access control policy, only the MaxCompute SQL engine can read the table. Other engines will not be able to access the table.
-
In addition to satisfying row-level permission requirements, a user must also have SELECT permission on the data to access it.
-
The filter conditions within GET_PARTITION_META can lead to different partition pruning effects in different scenarios.
-
Filter conditions apply only to the partition fields of a partitioned table. For example, you can allow access to standard storage and require that the value of the first-level partition is
2024.GET_PARTITION_META('storage_table', pt1, pt2).storagetier == 'standard') AND pt1='2024'When you use SQL to access
storage_tableand the WHERE clause does not contain a partition condition, the system natively supports partition pruning. This process avoids a full table scan by performing read-only access only on the required partitions instorage_table. -
The filter condition includes a value from a non-partitioned field, and an AND operation is used to connect the two filter conditions. For example, a condition to allow access to standard storage is combined with
a>100on a non-partitioned value by using an AND operation.GET_PARTITION_META('storage_table', pt1, pt2).storagetier == 'standard') AND a > 100When you use SQL to access
storage_tablewithout a partition condition in the WHERE clause, partition pruning is still supported, accessing only partitions stored asstandard. -
The filter criteria include a value for a non-partition field, and the two criteria are connected by an OR operation. For example, a condition that allows access to standard storage is combined with the non-partition value
a>100in an OR operation.get_partition_meta('storage_table', pt1, pt2).storagetier == 'standard') OR a > 100When you use SQL to access
storage_table, there are two scenarios:-
If the WHERE clause does not contain a partition condition, all partitions are scanned for data that satisfies
a>100. -
If a partition condition is specified in the
WHEREclause, only the data that satisfies conditions such asstandardora>100in the corresponding partitions is scanned.
-
-
Examples
Define the partitioned table storage_table.
CREATE TABLE storage_table(a BIGINT, b BIGINT) PARTITIONED BY (pt1 STRING, pt2 STRING);
-
Example 1:
Grant the
policy01permission to the default user to access standard storage data instorage_table. All users (including the Project Owner) cannot access infrequent access or long-term storage data, and an empty value is returned.CREATE ROW ACCESS POLICY policy01 ON storage_table TO DEFAULT FILTER USING (get_partition_meta('storage_table', pt1, pt2).storagetier == 'standard');The Logview Summary displays the following message when a row-level access policy is triggered:
The message
WARNING:[1,15] row access policy is enabled on table yyy_hp_storagetier.storage_table01indicates that a row access policy was triggered when you queried the table. -
Example 2:
Grant user
user_xthepolicy02permission to access low-frequency storage and long-term storage data instorage_table.CREATE ROW ACCESS POLICY policy02 ON storage_table TO USER (user_x) --You can also grant permissions to a role using TO ROLE rolename, and then assign the role to the user. FILTER USING (get_partition_meta('storage_table', pt1, pt2).storagetier IN ('lowfrequency','longterm'));Two scenarios can occur:
-
If the
policy01permission is set for a table, all users except for user_x can access the standard storage data ofstorage_tablebut receive a null value for its infrequent access or long-term storage data, while user_x can access the infrequent access and long-term storage data ofstorage_tablebut receives a null value for its standard storage data. -
If the
policy01permission is not configured for the table, all users except for user_x are denied access to any data instorage_tableand receive a null value. User_x can access data in Infrequent Access and long-term storage, but receives a null value when attempting to access data in standard storage.
-
-
Example 3:
The policy
policy03grants useruser_yaccess permission to all data instorage_table.CREATE ROW ACCESS POLICY policy03 ON storage_table TO USER (user_y) --You can also grant permissions to a role using TO ROLE rolename, and then assign the role to the user. FILTER USING (true); -- The constant 'true' means the user can access all data in the table.Two scenarios can occur:
-
If the
policy01permission is set for the table, all users (except for user_y) can access thestorage_tablestandard storage data, but cannot access its infrequent access or long-term storage data, and an empty value is returned. The useruser_ycan access data of all storage types instorage_table. -
If the
policy01permission is not set for the table, all users (except for user_y) cannot access any data stored instorage_table, and a null value is returned. Only useruser_ycan access all data stored instorage_table.
-