My Project
sql_const.h
Go to the documentation of this file.
00001 /* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00023 #ifndef SQL_CONST_INCLUDED
00024 #define SQL_CONST_INCLUDED
00025 
00026 #define LIBLEN FN_REFLEN-FN_LEN                 /* Max l{ngd p} dev */
00027 /* extra 4+4 bytes for slave tmp tables */
00028 #define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
00029 #define MAX_ALIAS_NAME 256
00030 #define MAX_FIELD_NAME 34                       /* Max colum name length +2 */
00031 #define MAX_SYS_VAR_LENGTH 32
00032 #define MAX_KEY MAX_INDEXES                     /* Max used keys */
00033 #define MAX_REF_PARTS 16U                       /* Max parts used as ref */
00034 #define MAX_KEY_LENGTH 3072U                    /* max possible key */
00035 #if SIZEOF_OFF_T > 4
00036 #define MAX_REFLENGTH 8                         /* Max length for record ref */
00037 #else
00038 #define MAX_REFLENGTH 4                         /* Max length for record ref */
00039 #endif
00040 #define MAX_HOSTNAME  61                        /* len+1 in mysql.user */
00041 
00042 #define MAX_MBWIDTH             3               /* Max multibyte sequence */
00043 #define MAX_FIELD_CHARLENGTH    255
00044 #define MAX_FIELD_VARCHARLENGTH 65535
00045 #define MAX_FIELD_BLOBLENGTH UINT_MAX32     /* cf field_blob::get_length() */
00046 
00052 #define CONVERT_IF_BIGGER_TO_BLOB 512           /* Used for CREATE ... SELECT */
00053 
00054 /* Max column width +1 */
00055 #define MAX_FIELD_WIDTH         (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
00056 
00057 #define MAX_BIT_FIELD_LENGTH    64      /* Max length in bits for bit fields */
00058 
00059 #define MAX_DATE_WIDTH          10      /* YYYY-MM-DD */
00060 #define MAX_TIME_WIDTH          10      /* -838:59:59 */
00061 #define MAX_TIME_FULL_WIDTH     23      /* -DDDDDD HH:MM:SS.###### */
00062 #define MAX_DATETIME_FULL_WIDTH 29      /* YYYY-MM-DD HH:MM:SS.###### AM */
00063 #define MAX_DATETIME_WIDTH      19      /* YYYY-MM-DD HH:MM:SS */
00064 #define MAX_DATETIME_COMPRESSED_WIDTH 14  /* YYYYMMDDHHMMSS */
00065 
00066 #define DATE_INT_DIGITS       8         /* YYYYMMDD       */
00067 #define TIME_INT_DIGITS       7         /* hhhmmss        */
00068 #define DATETIME_INT_DIGITS  14         /* YYYYMMDDhhmmss */
00069 
00070 #define MAX_TABLES      (sizeof(table_map)*8-3) /* Max tables in join */
00071 #define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
00072 #define OUTER_REF_TABLE_BIT     (((table_map) 1) << (sizeof(table_map)*8-2))
00073 #define RAND_TABLE_BIT  (((table_map) 1) << (sizeof(table_map)*8-1))
00074 #define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
00075                            RAND_TABLE_BIT)
00076 #define MAX_FIELDS      4096                    /* Limit in the .frm file */
00077 #define MAX_PARTITIONS  8192
00078 
00079 #define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
00080 
00081 #define DEFAULT_SORT_MEMORY (256UL* 1024UL)
00082 #define MIN_SORT_MEMORY     (32UL * 1024UL)
00083 
00084 /* Some portable defines */
00085 
00086 #define STRING_BUFFER_USUAL_SIZE 80
00087 
00088 /* Memory allocated when parsing a statement / saving a statement */
00089 #define MEM_ROOT_BLOCK_SIZE       8192
00090 #define MEM_ROOT_PREALLOC         8192
00091 #define TRANS_MEM_ROOT_BLOCK_SIZE 4096
00092 #define TRANS_MEM_ROOT_PREALLOC   4096
00093 
00094 #define DEFAULT_ERROR_COUNT     64
00095 #define EXTRA_RECORDS   10                      /* Extra records in sort */
00096 #define SCROLL_EXTRA    5                       /* Extra scroll-rows. */
00097 #define FIELD_NAME_USED ((uint) 32768)          /* Bit set if fieldname used */
00098 #define FORM_NAME_USED  ((uint) 16384)          /* Bit set if formname used */
00099 #define FIELD_NR_MASK   16383                   /* To get fieldnumber */
00100 #define FERR            -1                      /* Error from my_functions */
00101 #define CREATE_MODE     0                       /* Default mode on new files */
00102 #define NAMES_SEP_CHAR  '\377'                  /* Char to sep. names */
00103 
00104 #define READ_RECORD_BUFFER      (uint) (IO_SIZE*8) /* Pointer_buffer_size */
00105 #define DISK_BUFFER_SIZE        (uint) (IO_SIZE*16) /* Size of diskbuffer */
00106 
00107 #define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */
00108 
00109 /***************************************************************************
00110   Configuration parameters
00111 ****************************************************************************/
00112 
00113 #define ACL_CACHE_SIZE          256
00114 #define MAX_PASSWORD_LENGTH     32
00115 #define HOST_CACHE_SIZE         128
00116 #define MAX_ACCEPT_RETRY        10      // Test accept this many times
00117 #define MAX_FIELDS_BEFORE_HASH  32
00118 #define USER_VARS_HASH_SIZE     16
00119 #define TABLE_OPEN_CACHE_MIN    400
00120 #define TABLE_OPEN_CACHE_DEFAULT 2000
00121 #define TABLE_DEF_CACHE_DEFAULT 400
00122 
00127 #define MAX_CONNECTIONS_DEFAULT 151
00128 
00141 #define TABLE_DEF_CACHE_MIN     400
00142 
00143 /*
00144   Stack reservation.
00145   Feel free to raise this by the smallest amount you can to get the
00146   "execution_constants" test to pass.
00147 */
00148 #define STACK_MIN_SIZE          16000   // Abort if less stack during eval.
00149 
00150 #define STACK_MIN_SIZE_FOR_OPEN 1024*80
00151 #define STACK_BUFF_ALLOC        352     ///< For stack overrun checks
00152 #ifndef MYSQLD_NET_RETRY_COUNT
00153 #define MYSQLD_NET_RETRY_COUNT  10      ///< Abort read after this many int.
00154 #endif
00155 
00156 #define QUERY_ALLOC_BLOCK_SIZE          8192
00157 #define QUERY_ALLOC_PREALLOC_SIZE       8192
00158 #define TRANS_ALLOC_BLOCK_SIZE          4096
00159 #define TRANS_ALLOC_PREALLOC_SIZE       4096
00160 #define RANGE_ALLOC_BLOCK_SIZE          4096
00161 #define ACL_ALLOC_BLOCK_SIZE            1024
00162 #define UDF_ALLOC_BLOCK_SIZE            1024
00163 #define TABLE_ALLOC_BLOCK_SIZE          1024
00164 #define WARN_ALLOC_BLOCK_SIZE           2048
00165 #define WARN_ALLOC_PREALLOC_SIZE        1024
00166 
00167 /*
00168   The following parameters is to decide when to use an extra cache to
00169   optimise seeks when reading a big table in sorted order
00170 */
00171 #define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
00172 #define MIN_ROWS_TO_USE_TABLE_CACHE      100
00173 #define MIN_ROWS_TO_USE_BULK_INSERT      100
00174 
00180 #define ROW_EVALUATE_COST  0.20
00181 
00185 #define ROWID_COMPARE_COST 0.10  // Half the cost of a general row comparison
00186 
00187 /*
00188   For sequential disk seeks the cost formula is:
00189     DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST * #blocks_to_skip  
00190   
00191   The cost of average seek 
00192     DISK_SEEK_BASE_COST + DISK_SEEK_PROP_COST*BLOCKS_IN_AVG_SEEK =1.0.
00193 */
00194 #define DISK_SEEK_BASE_COST ((double)0.9)
00195 
00196 #define BLOCKS_IN_AVG_SEEK  128
00197 
00198 #define DISK_SEEK_PROP_COST ((double)0.1/BLOCKS_IN_AVG_SEEK)
00199 
00200 
00206 #define MATCHING_ROWS_IN_OTHER_TABLE 10
00207 
00208 /*
00209   Constants related to the use of temporary tables in query execution.
00210   Lookup and write operations are currently assumed to be equally costly
00211   (concerns HEAP_TEMPTABLE_ROW_COST and DISK_TEMPTABLE_ROW_COST).
00212 */
00213 /*
00214   Creating a Heap temporary table is by benchmark found to be as costly as
00215   writing 10 rows into the table.
00216 */
00217 #define HEAP_TEMPTABLE_CREATE_COST    2.0
00218 /*
00219   Writing a row to or reading a row from a Heap temporary table is equivalent
00220   to evaluating a row in the join engine.
00221 */
00222 #define HEAP_TEMPTABLE_ROW_COST       0.2
00223 /*
00224   Creating a MyISAM table is 20 times slower than creating a Heap table.
00225 */
00226 #define DISK_TEMPTABLE_CREATE_COST   40.0
00227 /*
00228   Generating MyIsam rows sequentially is 2 times slower than generating
00229   Heap rows, when number of rows is greater than 1000. However, we do not have
00230   benchmarks for very large tables, so setting this factor conservatively to
00231   be 5 times slower (ie the cost is 1.0).
00232 */
00233 #define DISK_TEMPTABLE_ROW_COST       1.0
00234 
00235 #define MY_CHARSET_BIN_MB_MAXLEN 1
00236 
00238 #define KEY_DEFAULT_PACK_LENGTH 8
00239 
00241 #define PROCESS_LIST_WIDTH 100
00242 /* Characters shown for the command in 'information_schema.processlist' */
00243 #define PROCESS_LIST_INFO_WIDTH 65535
00244 
00245 #define PRECISION_FOR_DOUBLE 53
00246 #define PRECISION_FOR_FLOAT  24
00247 
00248 /* -[digits].E+## */
00249 #define MAX_FLOAT_STR_LENGTH (FLT_DIG + 6)
00250 /* -[digits].E+### */
00251 #define MAX_DOUBLE_STR_LENGTH (DBL_DIG + 7)
00252 
00253 /*
00254   Default time to wait before aborting a new client connection
00255   that does not respond to "initial server greeting" timely
00256 */
00257 #define CONNECT_TIMEOUT         10
00258 
00259 /* The following can also be changed from the command line */
00260 #define DEFAULT_CONCURRENCY     10
00261 #define DELAYED_LIMIT           100             
00262 #define DELAYED_QUEUE_SIZE      1000
00263 #define DELAYED_WAIT_TIMEOUT    5*60            
00265 #define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
00266 
00271 #define MAX_TIME_ZONE_NAME_LENGTH       (NAME_LEN + 1)
00272 
00273 #if defined(__WIN__)
00274 #define INTERRUPT_PRIOR -2
00275 #define CONNECT_PRIOR   -1
00276 #define WAIT_PRIOR      0
00277 #define QUERY_PRIOR     2
00278 #else
00279 #define INTERRUPT_PRIOR 10
00280 #define CONNECT_PRIOR   9
00281 #define WAIT_PRIOR      8
00282 #define QUERY_PRIOR     6
00283 #endif /* __WIN92__ */
00284 
00285 #endif /* SQL_CONST_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines