# Function: grok_set_validation_params ## Overview This function sets validation parameters and thresholds based on the specified validation type for materialized view health checks. ## Schema `config.grok_set_validation_params` ## Parameters - `validation_type` (text): Type of validation to configure: 'quick', 'daily', or 'full' ## Return Value Returns a JSONB object containing validation parameters and thresholds: ```json { "params": { "sample_percent": 0.1, "confidence": 0.95, "margin": 0.03 }, "mismatch_threshold": 0.1, "time_threshold": "3 days" } ``` ## Description This function configures appropriate validation parameters and thresholds based on the specified validation type. It supports three validation modes, each with its own balance between thoroughness and performance: 1. **Quick** (default): Light validation for frequent checks - Sampling: 0.1% of records - Confidence level: 95% - Margin of error: 3% - Mismatch threshold: 0.1% (data mismatch tolerance) - Time threshold: 3 days (acceptable staleness) 2. **Daily**: Medium validation for daily maintenance - Sampling: 1% of records - Confidence level: 99% - Margin of error: 1% - Mismatch threshold: 0.05% (data mismatch tolerance) - Time threshold: 1 day (acceptable staleness) 3. **Full**: Thorough validation for critical checks - Sampling: 100% of records (full scan) - Confidence level: 99% - Margin of error: 0.5% - Mismatch threshold: 0.01% (data mismatch tolerance) - Time threshold: 12 hours (acceptable staleness) If an invalid validation type is provided, the function defaults to 'quick' mode parameters. ## Parameter Explanations - `sample_percent`: Percentage of records to sample during validation - `confidence`: Statistical confidence level for sampling - `margin`: Acceptable margin of error for sampling - `mismatch_threshold`: Maximum acceptable percentage of mismatched records - `time_threshold`: Maximum acceptable time since last refresh ## Dependencies This function is likely called by other materialized view health check functions to configure validation parameters. ## Usage Example ```sql -- Get validation parameters for daily checks SELECT config.grok_set_validation_params('daily'); -- Get validation parameters for thorough health check SELECT config.grok_set_validation_params('full'); ```