/* * Module load callback */ void _PG_init(void) { /* Define custom GUC variables. */ DefineCustomRealVariable("pg_trgm.similarity_threshold", "Sets the threshold used by the %% operator.", "Valid range is 0.0 .. 1.0.", &similarity_threshold, 0.3, 0.0, 1.0, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomRealVariable("pg_trgm.word_similarity_threshold", "Sets the threshold used by the <%% operator.", "Valid range is 0.0 .. 1.0.", &word_similarity_threshold, 0.6, 0.0, 1.0, PGC_USERSET, 0, NULL, NULL, NULL); }
/* Define custom GUC */ static void load_parameters() { DefineCustomBoolVariable("saio", "Use SA for query planning.", NULL, &enable_saio, true, PGC_USERSET, 0, SAIO_GUC_HOOK_VALUES); DefineCustomIntVariable("saio_threshold", "Sets the threshold of FROM items beyond which SAIO is used.", NULL, &saio_threshold, 14, 1, INT_MAX, PGC_USERSET, 0, SAIO_GUC_HOOK_VALUES); DefineCustomRealVariable("saio_seed", "SA random seed.", NULL, &saio_seed, 0.0, 0.0, 1.0, PGC_USERSET, 0, SAIO_GUC_HOOK_VALUES); DefineCustomIntVariable("saio_equilibrium_factor", "SA scaling factor for reaching equilibirum.", NULL, &saio_equilibrium_factor, 16, 1, INT_MAX, PGC_USERSET, 0, SAIO_GUC_HOOK_VALUES); DefineCustomRealVariable("saio_initial_temperature_factor", "SA scaling factor for initial temperature.", NULL, &saio_initial_temperature_factor, 2.0, 0.0, 10.0, PGC_USERSET, 0, SAIO_GUC_HOOK_VALUES); DefineCustomRealVariable("saio_temperature_reduction_factor", "SA temperature reduction factor.", NULL, &saio_temperature_reduction_factor, 0.9, 0.0, 1.0, PGC_USERSET, 0, SAIO_GUC_HOOK_VALUES); DefineCustomIntVariable("saio_moves_before_frozen", "SA moves before considering system frozen.", NULL, &saio_moves_before_frozen, 4, 1, INT_MAX, PGC_USERSET, 0, SAIO_GUC_HOOK_VALUES); }
static void pg_panic_load_params(void) { DefineCustomRealVariable("pg_panic.luck_factor", "percentage of triggering PANIC when planning query", "Default of 0.001, range of values being [0..1]", &luck_factor, 0.001, 0.0, 1.0, PGC_USERSET, 0, NULL, NULL, NULL); }
/* * Module load callback */ void _PG_init(void) { /* Define custom GUC variables. */ DefineCustomIntVariable("auto_explain.log_min_duration", "Sets the minimum execution time above which plans will be logged.", "Zero prints all plans. -1 turns this feature off.", &auto_explain_log_min_duration, -1, -1, INT_MAX / 1000, PGC_SUSET, GUC_UNIT_MS, NULL, NULL, NULL); DefineCustomBoolVariable("auto_explain.log_analyze", "Use EXPLAIN ANALYZE for plan logging.", NULL, &auto_explain_log_analyze, false, PGC_SUSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable("auto_explain.log_verbose", "Use EXPLAIN VERBOSE for plan logging.", NULL, &auto_explain_log_verbose, false, PGC_SUSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable("auto_explain.log_buffers", "Log buffers usage.", NULL, &auto_explain_log_buffers, false, PGC_SUSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable("auto_explain.log_triggers", "Include trigger statistics in plans.", "This has no effect unless log_analyze is also set.", &auto_explain_log_triggers, false, PGC_SUSET, 0, NULL, NULL, NULL); DefineCustomEnumVariable("auto_explain.log_format", "EXPLAIN format to be used for plan logging.", NULL, &auto_explain_log_format, EXPLAIN_FORMAT_TEXT, format_options, PGC_SUSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable("auto_explain.log_nested_statements", "Log nested statements.", NULL, &auto_explain_log_nested_statements, false, PGC_SUSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable("auto_explain.log_timing", "Collect timing data, not just row counts.", NULL, &auto_explain_log_timing, true, PGC_SUSET, 0, NULL, NULL, NULL); DefineCustomRealVariable("auto_explain.sample_rate", "Fraction of queries to process.", NULL, &auto_explain_sample_rate, 1.0, 0.0, 1.0, PGC_SUSET, 0, NULL, NULL, NULL); EmitWarningsOnPlaceholders("auto_explain"); /* Install hooks. */ prev_ExecutorStart = ExecutorStart_hook; ExecutorStart_hook = explain_ExecutorStart; prev_ExecutorRun = ExecutorRun_hook; ExecutorRun_hook = explain_ExecutorRun; prev_ExecutorFinish = ExecutorFinish_hook; ExecutorFinish_hook = explain_ExecutorFinish; prev_ExecutorEnd = ExecutorEnd_hook; ExecutorEnd_hook = explain_ExecutorEnd; }
static void pgstrom_init_misc_guc(void) { /* GUC variables according to the device information */ DefineCustomBoolVariable("pg_strom.enabled", "Enables the planner's use of PG-Strom", NULL, &pgstrom_enabled, true, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); DefineCustomBoolVariable("pg_strom.perfmon", "Enables the performance monitor of PG-Strom", NULL, &pgstrom_perfmon_enabled, false, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); DefineCustomBoolVariable("pg_strom.show_device_kernel", "Enables to show device kernel on EXPLAIN", NULL, &pgstrom_show_device_kernel, false, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); DefineCustomIntVariable("pg_strom.chunk_size", "default size of pgstrom_data_store in MB", NULL, &pgstrom_chunk_size, 15, 4, 128, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); DefineCustomIntVariable("pg_strom.min_async_chunks", "least number of chunks to be run asynchronously", NULL, &pgstrom_min_async_chunks, 2, 2, INT_MAX, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); DefineCustomIntVariable("pg_strom.max_async_chunks", "max number of chunk to be run asynchronously", NULL, &pgstrom_max_async_chunks, 3, pgstrom_min_async_chunks + 1, INT_MAX, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); if (pgstrom_max_async_chunks <= pgstrom_min_async_chunks) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("\"pg_strom.max_async_chunks\" must be larger than \"pg_strom.min_async_chunks\""))); DefineCustomRealVariable("gpu_setup_cost", "Cost to setup GPU device to run", NULL, &pgstrom_gpu_setup_cost, 500 * DEFAULT_SEQ_PAGE_COST, 0, DBL_MAX, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); DefineCustomRealVariable("gpu_operator_cost", "Cost of processing each operators by GPU", NULL, &pgstrom_gpu_operator_cost, DEFAULT_CPU_OPERATOR_COST / 100.0, 0, DBL_MAX, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); DefineCustomRealVariable("gpu_tuple_cost", "Cost of processing each tuple for GPU", NULL, &pgstrom_gpu_tuple_cost, DEFAULT_CPU_TUPLE_COST / 32, 0, DBL_MAX, PGC_USERSET, GUC_NOT_IN_SAMPLE, NULL, NULL, NULL); }
/* Register Citus configuration variables. */ static void RegisterCitusConfigVariables(void) { DefineCustomStringVariable( "citus.worker_list_file", gettext_noop("Sets the server's \"worker_list\" configuration file."), NULL, &WorkerListFileName, NULL, PGC_POSTMASTER, GUC_SUPERUSER_ONLY, NULL, NULL, NULL); NormalizeWorkerListPath(); DefineCustomBoolVariable( "citus.binary_master_copy_format", gettext_noop("Use the binary master copy format."), gettext_noop("When enabled, data is copied from workers to the master " "in PostgreSQL's binary serialization format."), &BinaryMasterCopyFormat, false, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.binary_worker_copy_format", gettext_noop("Use the binary worker copy format."), gettext_noop("When enabled, data is copied from workers to workers " "in PostgreSQL's binary serialization format when " "joining large tables."), &BinaryWorkerCopyFormat, false, PGC_SIGHUP, 0, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.expire_cached_shards", gettext_noop("Enables shard cache expiration if a shard's size on disk has " "changed."), gettext_noop("When appending to an existing shard, old data may still be cached " "on other workers. This configuration entry activates automatic " "expiration, but should not be used with manual updates to shards."), &ExpireCachedShards, false, PGC_SIGHUP, 0, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.subquery_pushdown", gettext_noop("Enables supported subquery pushdown to workers."), NULL, &SubqueryPushdown, false, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.log_multi_join_order", gettext_noop("Logs the distributed join order to the server log."), gettext_noop("We use this private configuration entry as a debugging aid. " "If enabled, we print the distributed join order."), &LogMultiJoinOrder, false, PGC_USERSET, GUC_NO_SHOW_ALL, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.explain_multi_logical_plan", gettext_noop("Enables Explain to print out distributed logical plans."), gettext_noop("We use this private configuration entry as a debugging aid. " "If enabled, the Explain command prints out the optimized " "logical plan for distributed queries."), &ExplainMultiLogicalPlan, false, PGC_USERSET, GUC_NO_SHOW_ALL, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.explain_multi_physical_plan", gettext_noop("Enables Explain to print out distributed physical plans."), gettext_noop("We use this private configuration entry as a debugging aid. " "If enabled, the Explain command prints out the physical " "plan for distributed queries."), &ExplainMultiPhysicalPlan, false, PGC_USERSET, GUC_NO_SHOW_ALL, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.explain_distributed_queries", gettext_noop("Enables Explain for distributed queries."), gettext_noop("When enabled, the Explain command shows remote and local " "plans when used with a distributed query. It is enabled " "by default, but can be disabled for regression tests."), &ExplainDistributedQueries, true, PGC_USERSET, GUC_NO_SHOW_ALL, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.explain_all_tasks", gettext_noop("Enables showing output for all tasks in Explain."), gettext_noop("The Explain command for distributed queries shows " "the remote plan for a single task by default. When " "this configuration entry is enabled, the plan for " "all tasks is shown, but the Explain takes longer."), &ExplainAllTasks, false, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.all_modifications_commutative", gettext_noop("Bypasses commutativity checks when enabled"), NULL, &AllModificationsCommutative, false, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomBoolVariable( "citus.enable_ddl_propagation", gettext_noop("Enables propagating DDL statements to worker shards"), NULL, &EnableDDLPropagation, true, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomIntVariable( "citus.shard_replication_factor", gettext_noop("Sets the replication factor for shards."), gettext_noop("Shards are replicated across nodes according to this " "replication factor. Note that shards read this " "configuration value at sharded table creation time, " "and later reuse the initially read value."), &ShardReplicationFactor, 2, 1, 100, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomIntVariable( "citus.shard_max_size", gettext_noop("Sets the maximum size a shard will grow before it gets split."), gettext_noop("Shards store table and file data. When the source " "file's size for one shard exceeds this configuration " "value, the database ensures that either a new shard " "gets created, or the current one gets split. Note that " "shards read this configuration value at sharded table " "creation time, and later reuse the initially read value."), &ShardMaxSize, 1048576, 256, INT_MAX, /* max allowed size not set to MAX_KILOBYTES on purpose */ PGC_USERSET, GUC_UNIT_KB, NULL, NULL, NULL); DefineCustomIntVariable( "citus.max_worker_nodes_tracked", gettext_noop("Sets the maximum number of worker nodes that are tracked."), gettext_noop("Worker nodes' network locations, their membership and " "health status are tracked in a shared hash table on " "the master node. This configuration value limits the " "size of the hash table, and consequently the maximum " "number of worker nodes that can be tracked."), &MaxWorkerNodesTracked, 2048, 8, INT_MAX, PGC_POSTMASTER, 0, NULL, NULL, NULL); DefineCustomIntVariable( "citus.remote_task_check_interval", gettext_noop("Sets the frequency at which we check job statuses."), gettext_noop("The master node assigns tasks to workers nodes, and " "then regularly checks with them about each task's " "progress. This configuration value sets the time " "interval between two consequent checks."), &RemoteTaskCheckInterval, 10, 1, REMOTE_NODE_CONNECT_TIMEOUT, PGC_USERSET, GUC_UNIT_MS, NULL, NULL, NULL); DefineCustomIntVariable( "citus.task_tracker_delay", gettext_noop("Task tracker sleep time between task management rounds."), gettext_noop("The task tracker process wakes up regularly, walks over " "all tasks assigned to it, and schedules and executes these " "tasks. Then, the task tracker sleeps for a time period " "before walking over these tasks again. This configuration " "value determines the length of that sleeping period."), &TaskTrackerDelay, 200, 10, 100000, PGC_SIGHUP, GUC_UNIT_MS, NULL, NULL, NULL); DefineCustomIntVariable( "citus.max_assign_task_batch_size", gettext_noop("Sets the maximum number of tasks to assign per round."), gettext_noop("The master node synchronously assigns tasks to workers in " "batches. Bigger batches allow for faster task assignment, " "but it may take longer for all workers to get tasks " "if the number of workers is large. This configuration " "value controls the maximum batch size."), &MaxAssignTaskBatchSize, 64, 1, INT_MAX, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomIntVariable( "citus.max_tracked_tasks_per_node", gettext_noop("Sets the maximum number of tracked tasks per node."), gettext_noop("The task tracker processes keeps all assigned tasks in " "a shared hash table, and schedules and executes these " "tasks as appropriate. This configuration value limits " "the size of the hash table, and therefore the maximum " "number of tasks that can be tracked at any given time."), &MaxTrackedTasksPerNode, 1024, 8, INT_MAX, PGC_POSTMASTER, 0, NULL, NULL, NULL); DefineCustomIntVariable( "citus.max_running_tasks_per_node", gettext_noop("Sets the maximum number of tasks to run concurrently per node."), gettext_noop("The task tracker process schedules and executes the tasks " "assigned to it as appropriate. This configuration value " "sets the maximum number of tasks to execute concurrently " "on one node at any given time."), &MaxRunningTasksPerNode, 8, 1, INT_MAX, PGC_SIGHUP, 0, NULL, NULL, NULL); DefineCustomIntVariable( "citus.partition_buffer_size", gettext_noop("Sets the buffer size to use for partition operations."), gettext_noop("Worker nodes allow for table data to be repartitioned " "into multiple text files, much like Hadoop's Map " "command. This configuration value sets the buffer size " "to use per partition operation. After the buffer fills " "up, we flush the repartitioned data into text files."), &PartitionBufferSize, 8192, 0, (INT_MAX / 1024), /* result stored in int variable */ PGC_USERSET, GUC_UNIT_KB, NULL, NULL, NULL); DefineCustomIntVariable( "citus.large_table_shard_count", gettext_noop("The shard count threshold over which a table is considered large."), gettext_noop("A distributed table is considered to be large if it has " "more shards than the value specified here. This largeness " "criteria is then used in picking a table join order during " "distributed query planning."), &LargeTableShardCount, 4, 1, 10000, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomIntVariable( "citus.limit_clause_row_fetch_count", gettext_noop("Number of rows to fetch per task for limit clause optimization."), gettext_noop("Select queries get partitioned and executed as smaller " "tasks. In some cases, select queries with limit clauses " "may need to fetch all rows from each task to generate " "results. In those cases, and where an approximation would " "produce meaningful results, this configuration value sets " "the number of rows to fetch from each task."), &LimitClauseRowFetchCount, -1, -1, INT_MAX, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomRealVariable( "citus.count_distinct_error_rate", gettext_noop("Desired error rate when calculating count(distinct) " "approximates using the postgresql-hll extension. " "0.0 disables approximations for count(distinct); 1.0 " "provides no guarantees about the accuracy of results."), NULL, &CountDistinctErrorRate, 0.0, 0.0, 1.0, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomEnumVariable( "citus.multi_shard_commit_protocol", gettext_noop("Sets the commit protocol for commands modifying multiple shards."), gettext_noop("When a failure occurs during commands that modify multiple " "shards (currently, only COPY on distributed tables modifies more " "than one shard), two-phase commit is required to ensure data is " "never lost. Change this setting to '2pc' from its default '1pc' to " "enable 2 PC. You must also set max_prepared_transactions on the " "worker nodes. Recovery from failed 2PCs is currently manual."), &MultiShardCommitProtocol, COMMIT_PROTOCOL_1PC, multi_shard_commit_protocol_options, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomEnumVariable( "citus.task_assignment_policy", gettext_noop("Sets the policy to use when assigning tasks to worker nodes."), gettext_noop("The master node assigns tasks to worker nodes based on shard " "locations. This configuration value specifies the policy to " "use when making these assignments. The greedy policy aims to " "evenly distribute tasks across worker nodes, first-replica just " "assigns tasks in the order shard placements were created, " "and the round-robin policy assigns tasks to worker nodes in " "a round-robin fashion."), &TaskAssignmentPolicy, TASK_ASSIGNMENT_GREEDY, task_assignment_policy_options, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomEnumVariable( "citus.task_executor_type", gettext_noop("Sets the executor type to be used for distributed queries."), gettext_noop("The master node chooses between two different executor types " "when executing a distributed query.The real-time executor is " "optimal for simple key-value lookup queries and queries that " "involve aggregations and/or co-located joins on multiple shards. " "The task-tracker executor is optimal for long-running, complex " "queries that touch thousands of shards and/or that involve table " "repartitioning."), &TaskExecutorType, MULTI_EXECUTOR_REAL_TIME, task_executor_type_options, PGC_USERSET, 0, NULL, NULL, NULL); DefineCustomEnumVariable( "citus.shard_placement_policy", gettext_noop("Sets the policy to use when choosing nodes for shard placement."), gettext_noop("The master node chooses which worker nodes to place new shards " "on. This configuration value specifies the policy to use when " "selecting these nodes. The local-node-first policy places the " "first replica on the client node and chooses others randomly. " "The round-robin policy aims to distribute shards evenly across " "the cluster by selecting nodes in a round-robin fashion." "The random policy picks all workers randomly."), &ShardPlacementPolicy, SHARD_PLACEMENT_ROUND_ROBIN, shard_placement_policy_options, PGC_USERSET, 0, NULL, NULL, NULL); /* warn about config items in the citus namespace that are not registered above */ EmitWarningsOnPlaceholders("citus"); }
/* * Module load callback * * Holds GUC variables that cause some behavior changes in similarity functions * */ void _PG_init(void) { static const struct config_enum_entry pgs_tokenizer_options[] = { {"alnum", PGS_UNIT_ALNUM, false}, {"gram", PGS_UNIT_GRAM, false}, {"word", PGS_UNIT_WORD, false}, {"camelcase", PGS_UNIT_CAMELCASE, false}, {NULL, 0, false} }; static const struct config_enum_entry pgs_gram_options[] = { {"gram", PGS_UNIT_GRAM, false}, {NULL, 0, false} }; /* Block */ DefineCustomEnumVariable("pg_similarity.block_tokenizer", "Sets the tokenizer for Block similarity function.", "Valid values are \"alnum\", \"gram\", \"word\", or \"camelcase\".", &pgs_block_tokenizer, PGS_UNIT_ALNUM, pgs_tokenizer_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.block_threshold", "Sets the threshold used by the Block similarity function.", "Valid range is 0.0 .. 1.0.", &pgs_block_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.block_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_block_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Cosine */ DefineCustomEnumVariable("pg_similarity.cosine_tokenizer", "Sets the tokenizer for Cosine similarity function.", "Valid values are \"alnum\", \"gram\", \"word\", or \"camelcase\".", &pgs_cosine_tokenizer, PGS_UNIT_ALNUM, pgs_tokenizer_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.cosine_threshold", "Sets the threshold used by the Cosine similarity function.", "Valid range is 0.0 .. 1.0.", &pgs_cosine_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.cosine_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_cosine_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Dice */ DefineCustomEnumVariable("pg_similarity.dice_tokenizer", "Sets the tokenizer for Dice similarity measure.", "Valid values are \"alnum\", \"gram\", \"word\", or \"camelcase\".", &pgs_dice_tokenizer, PGS_UNIT_ALNUM, pgs_tokenizer_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.dice_threshold", "Sets the threshold used by the Dice similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_dice_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.dice_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_dice_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Euclidean */ DefineCustomEnumVariable("pg_similarity.euclidean_tokenizer", "Sets the tokenizer for Euclidean similarity measure.", "Valid values are \"alnum\", \"gram\", \"word\", or \"camelcase\".", &pgs_euclidean_tokenizer, PGS_UNIT_ALNUM, pgs_tokenizer_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.euclidean_threshold", "Sets the threshold used by the Euclidean similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_euclidean_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.euclidean_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_euclidean_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Hamming */ DefineCustomRealVariable("pg_similarity.hamming_threshold", "Sets the threshold used by the Block similarity metric.", "Valid range is 0.0 .. 1.0.", &pgs_hamming_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.hamming_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_hamming_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Jaccard */ DefineCustomEnumVariable("pg_similarity.jaccard_tokenizer", "Sets the tokenizer for Jaccard similarity measure.", "Valid values are \"alnum\", \"gram\", \"word\", or \"camelcase\".", &pgs_jaccard_tokenizer, PGS_UNIT_ALNUM, pgs_tokenizer_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.jaccard_threshold", "Sets the threshold used by the Jaccard similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_jaccard_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.jaccard_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_jaccard_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Jaro */ DefineCustomRealVariable("pg_similarity.jaro_threshold", "Sets the threshold used by the Jaro similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_jaro_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.jaro_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_jaro_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Jaro-Winkler */ DefineCustomRealVariable("pg_similarity.jarowinkler_threshold", "Sets the threshold used by the Jaro similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_jarowinkler_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.jarowinkler_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_jarowinkler_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Levenshtein */ DefineCustomRealVariable("pg_similarity.levenshtein_threshold", "Sets the threshold used by the Levenshtein similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_levenshtein_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.levenshtein_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_levenshtein_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Matching Coefficient */ DefineCustomEnumVariable("pg_similarity.matching_tokenizer", "Sets the tokenizer for Matching Coefficient similarity measure.", "Valid values are \"alnum\", \"gram\", \"word\", or \"camelcase\".", &pgs_matching_tokenizer, PGS_UNIT_ALNUM, pgs_tokenizer_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.matching_threshold", "Sets the threshold used by the Matching Coefficient similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_matching_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.matching_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_matching_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Monge-Elkan */ DefineCustomEnumVariable("pg_similarity.mongeelkan_tokenizer", "Sets the tokenizer for Monge-Elkan similarity measure.", "Valid values are \"alnum\", \"gram\", \"word\", or \"camelcase\".", &pgs_mongeelkan_tokenizer, PGS_UNIT_ALNUM, pgs_tokenizer_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.mongeelkan_threshold", "Sets the threshold used by the Monge-Elkan similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_mongeelkan_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.mongeelkan_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_mongeelkan_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Needleman-Wunsch */ DefineCustomRealVariable("pg_similarity.nw_threshold", "Sets the threshold used by the Needleman-Wunsch similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_nw_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.nw_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_nw_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.nw_gap_penalty", "Sets the gap penalty used by the Needleman-Wunsch similarity measure.", NULL, &pgs_nw_gap_penalty, -5.0, LONG_MIN, LONG_MAX, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Overlap Coefficient */ DefineCustomEnumVariable("pg_similarity.overlap_tokenizer", "Sets the tokenizer for Overlap Coefficient similarity measure.", "Valid values are \"alnum\", \"gram\", \"word\", or \"camelcase\".", &pgs_overlap_tokenizer, PGS_UNIT_ALNUM, pgs_tokenizer_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.overlap_threshold", "Sets the threshold used by the Overlap Coefficient similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_overlap_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.overlap_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_overlap_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Q-Gram */ DefineCustomEnumVariable("pg_similarity.qgram_tokenizer", "Sets the tokenizer for Q-Gram similarity function.", "Valid value is \"gram\".", &pgs_qgram_tokenizer, PGS_UNIT_GRAM, pgs_gram_options, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomRealVariable("pg_similarity.qgram_threshold", "Sets the threshold used by the Q-Gram similarity function.", "Valid range is 0.0 .. 1.0.", &pgs_qgram_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.qgram_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_qgram_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Smith-Waterman */ DefineCustomRealVariable("pg_similarity.sw_threshold", "Sets the threshold used by the Smith-Waterman similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_sw_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.sw_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_sw_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); /* Smith-Waterman-Gotoh */ DefineCustomRealVariable("pg_similarity.swg_threshold", "Sets the threshold used by the Smith-Waterman-Gotoh similarity measure.", "Valid range is 0.0 .. 1.0.", &pgs_swg_threshold, 0.7, 0.0, 1.0, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); DefineCustomBoolVariable("pg_similarity.swg_is_normalized", "Sets if the result value is normalized or not.", NULL, &pgs_swg_is_normalized, true, PGC_USERSET, 0, #if PG_VERSION_NUM >= 90100 NULL, #endif NULL, NULL); }