In Vertica we have the option to associate database objects with a specific storage location. This is very useful when you have different types of disks available on your Vertica Cluster hosts. Example: - imagine you have on your Vertica Cluster nodes SSD disks(fast disks) and some other HDD disks used for storing your database data. In this case you could place your hot objects(frequently accessed) on your SSD disks and the other objects(infrequently accessed) in the HDD disks locations. To see how to create a Storage Location follow this link. Note: - if no storage policy exists on the database then Vertica will continue to use any storage available in the default way. Once you create a storage policy it is not necessary to allocate all objects to it, this can be done arbitrary as per your need. Important: -Storage policy have a higher priority than the storage ranking setting. The storage ranking is based on your storage performance measurements.
dbadmin= select location_path,location_label from storage_locations;
location_path | location_label
-----------------------------------+----------------
/home/dbadmin/d/v_d_node0001_data |
/u03/data_store1 | DataCollector
/u02/load/data_store2 | FAST_SSD_DISK
dbadmin= create table one (id int);
CREATE TABLE
dbadmin= select set_object_storage_policy ('one', 'FAST_SSD_DISK');
set_object_storage_policy
----------------------------
Object storage policy set.
(1 row)
dbadmin= insert/*+ direct*/ into one values(1);
OUTPUT
--------
1
(1 row)
dbadmin= select distinct projection_name, storage_type, location_label from v_monitor.storage_containers;
projection_name | storage_type | location_label
------------------------+--------------+----------------
one_super | ROS | FAST_SSD_DISK
store_sales_fact_super | ROS |
[root@DCXLG001 data_store2]# tree /u02/load/data_store2
/u02/load/data_store2
+-- 375
+-- 379
+-- 383
¦ +-- 45035996273771383
¦ +-- 45035996273771383_0.fdb
¦ +-- 45035996273771383_0.pidx
+-- 387
+-- 45035996273771387
+-- 45035996273771387_0.fdb
+-- 45035996273771387_0.pidx
6 directories, 4 files
dbadmin= select * from v_monitor.storage_policies;
schema_name | object_name | policy_details | location_label
-------------+-------------+----------------+----------------
public | one | Table | FAST_SSD_DISK
(1 row)
dbadmin= select * from v_monitor.storage_tiers;
location_label | node_count | location_count | ros_container_count | total_occupied_size
----------------+------------+----------------+---------------------+---------------------
DataCollector | 1 | 1 | 0 | 0
FAST_SSD_DISK | 1 | 1 | 1 | 51
(2 rows)