HonahX commented on code in PR #1468:
URL: https://github.com/apache/polaris/pull/1468#discussion_r2062801540


##########
extension/persistence/relational-jdbc/src/main/resources/postgres/schema-v1.sql:
##########
@@ -91,3 +91,17 @@ CREATE TABLE IF NOT EXISTS principal_authentication_data (
 );
 
 COMMENT ON TABLE principal_authentication_data IS 'authentication data for 
client';
+
+DROP TABLE IF EXISTS policy_mapping_record;
+CREATE TABLE IF NOT EXISTS policy_mapping_record (
+    realm_id TEXT NOT NULL,
+    target_catalog_id BIGINT NOT NULL,
+    target_id BIGINT NOT NULL,
+    policy_type_code INTEGER NOT NULL,
+    policy_catalog_id BIGINT NOT NULL,
+    policy_id BIGINT NOT NULL,
+    parameters JSONB NOT NULL DEFAULT '{}'::JSONB,
+    PRIMARY KEY (realm_id, target_catalog_id, target_id, policy_type_code, 
policy_catalog_id, policy_id)
+);
+
+CREATE INDEX IF NOT EXISTS idx_policy_mapping_record ON policy_mapping_record 
(realm_id, target_catalog_id, target_id, policy_type_code, policy_catalog_id, 
policy_id);

Review Comment:
   ```suggestion
   CREATE INDEX IF NOT EXISTS idx_policy_mapping_record ON 
policy_mapping_record (realm_id, policy_type_code, policy_catalog_id, 
policy_id, target_catalog_id, target_id);
   ```
   
   In this index, the policy related fields should be in the front otherwise it 
would be the same as the primary key.



##########
extension/persistence/relational-jdbc/src/main/resources/h2/schema-v1.sql:
##########
@@ -91,3 +91,17 @@ CREATE TABLE IF NOT EXISTS principal_authentication_data (
 );
 
 COMMENT ON TABLE principal_authentication_data IS 'authentication data for 
client';
+
+DROP TABLE IF EXISTS policy_mapping_record;
+CREATE TABLE IF NOT EXISTS policy_mapping_record (
+    realm_id TEXT NOT NULL,
+    target_catalog_id BIGINT NOT NULL,
+    target_id BIGINT NOT NULL,
+    policy_type_code INTEGER NOT NULL,
+    policy_catalog_id BIGINT NOT NULL,
+    policy_id BIGINT NOT NULL,
+    parameters TEXT NOT NULL DEFAULT '{}',
+    PRIMARY KEY (realm_id, target_catalog_id, target_id, policy_type_code, 
policy_catalog_id, policy_id)
+);
+
+CREATE INDEX IF NOT EXISTS idx_policy_mapping_record ON policy_mapping_record 
(realm_id, target_catalog_id, target_id, policy_type_code, policy_catalog_id, 
policy_id);

Review Comment:
   Similar as above



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to