|
2 | 2 | * Routines for handling of 'SET var TO', 'SHOW var' and 'RESET var'
|
3 | 3 | * statements.
|
4 | 4 | *
|
5 |
| - * $Id: variable.c,v 1.5 1997/04/23 06:09:36 vadim Exp $ |
| 5 | + * $Id: variable.c,v 1.6 1997/04/24 15:41:37 vadim Exp $ |
6 | 6 | *
|
7 | 7 | */
|
8 | 8 |
|
|
11 | 11 | #include "postgres.h"
|
12 | 12 | #include "miscadmin.h"
|
13 | 13 | #include "tcop/variable.h"
|
| 14 | +#include "utils/builtins.h" |
| 15 | +#include "optimizer/internal.h" |
| 16 | + |
| 17 | +extern Cost _cpu_page_wight_; |
| 18 | +extern Cost _cpu_index_page_wight_; |
14 | 19 |
|
15 | 20 | /*-----------------------------------------------------------------------*/
|
16 | 21 | #if USE_EURODATES
|
@@ -64,6 +69,50 @@ static bool reset_null(const char *value)
|
64 | 69 | return TRUE;
|
65 | 70 | }
|
66 | 71 |
|
| 72 | +static bool parse_cost_heap (const char *value) |
| 73 | +{ |
| 74 | + float32 res = float4in ((char*)value); |
| 75 | + |
| 76 | + _cpu_page_wight_ = *res; |
| 77 | + |
| 78 | + return TRUE; |
| 79 | +} |
| 80 | + |
| 81 | +static bool show_cost_heap () |
| 82 | +{ |
| 83 | + |
| 84 | + elog (NOTICE, "COST_HEAP is %f", _cpu_page_wight_); |
| 85 | + return TRUE; |
| 86 | +} |
| 87 | + |
| 88 | +static bool reset_cost_heap () |
| 89 | +{ |
| 90 | + _cpu_page_wight_ = _CPU_PAGE_WEIGHT_; |
| 91 | + return TRUE; |
| 92 | +} |
| 93 | + |
| 94 | +static bool parse_cost_index (const char *value) |
| 95 | +{ |
| 96 | + float32 res = float4in ((char*)value); |
| 97 | + |
| 98 | + _cpu_index_page_wight_ = *res; |
| 99 | + |
| 100 | + return TRUE; |
| 101 | +} |
| 102 | + |
| 103 | +static bool show_cost_index () |
| 104 | +{ |
| 105 | + |
| 106 | + elog (NOTICE, "COST_INDEX is %f", _cpu_index_page_wight_); |
| 107 | + return TRUE; |
| 108 | +} |
| 109 | + |
| 110 | +static bool reset_cost_index () |
| 111 | +{ |
| 112 | + _cpu_index_page_wight_ = _CPU_INDEX_PAGE_WEIGHT_; |
| 113 | + return TRUE; |
| 114 | +} |
| 115 | + |
67 | 116 | static bool parse_date(const char *value)
|
68 | 117 | {
|
69 | 118 | char tok[32];
|
@@ -149,6 +198,10 @@ struct VariableParsers
|
149 | 198 | {
|
150 | 199 | { "datestyle", parse_date, show_date, reset_date },
|
151 | 200 | { "timezone", parse_null, show_null, reset_null },
|
| 201 | + { "cost_heap", parse_cost_heap, |
| 202 | + show_cost_heap, reset_cost_heap }, |
| 203 | + { "cost_index", parse_cost_index, |
| 204 | + show_cost_index, reset_cost_index }, |
152 | 205 | { NULL, NULL, NULL }
|
153 | 206 | };
|
154 | 207 |
|
|
0 commit comments