You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+66-59Lines changed: 66 additions & 59 deletions
Original file line number
Diff line number
Diff line change
@@ -54,46 +54,61 @@ We are continuously adding more functionality to go-mysql-server. We support a s
54
54
55
55
We support and actively test against certain third-party clients to ensure compatibility between them and go-mysql-server. You can check out the list of supported third party clients in the [SUPPORTED_CLIENTS](./SUPPORTED_CLIENTS.md) file along with some examples on how to connect to go-mysql-server using them.
56
56
57
-
## Custom functions
58
-
59
-
-`COUNT(expr)`: Returns a count of the number of non-NULL values of expr in the rows retrieved by a SELECT statement.
60
-
-`MIN(expr)`: Returns the minimum value of expr.
61
-
-`MAX(expr)`: Returns the maximum value of expr.
62
-
-`AVG(expr)`: Returns the average value of expr.
63
-
-`SUM(expr)`: Returns the sum of expr.
64
-
-`IS_BINARY(blob)`: Returns whether a BLOB is a binary file or not.
65
-
-`SUBSTRING(str, pos)`, `SUBSTRING(str, pos, len)` : Return a substring from the provided string.
66
-
-`SUBSTR(str, pos)`, `SUBSTR(str, pos, len)` : Return a substring from the provided string.
67
-
-`MID(str, pos)`, `MID(str, pos, len)` : Return a substring from the provided string.
68
-
- Date and Timestamp functions: `YEAR(date)`, `MONTH(date)`, `DAY(date)`, `WEEKDAY(date)`, `HOUR(date)`, `MINUTE(date)`, `SECOND(date)`, `DAYOFWEEK(date)`, `DAYOFYEAR(date)`, `NOW()`.
69
-
-`ARRAY_LENGTH(json)`: If the json representation is an array, this function returns its size.
70
-
-`SPLIT(str,sep)`: Receives a string and a separator and returns the parts of the string split by the separator as a JSON array of strings.
71
-
-`CONCAT(...)`: Concatenate any group of fields into a single string.
72
-
-`CONCAT_WS(sep, ...)`: Concatenate any group of fields into a single string. The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL.
73
-
-`COALESCE(...)`: The function returns the first non-null value in a list.
74
-
-`LOWER(str)`, `UPPER(str)`: Receives a string and modify it changing all the chars to upper or lower case.
75
-
-`CEILING(number)`, `CEIL(number)`: Return the smallest integer value that is greater than or equal to `number`.
76
-
-`FLOOR(number)`: Return the largest integer value that is less than or equal to `number`.
77
-
-`ROUND(number, decimals)`: Round the `number` to `decimals` decimal places.
78
-
-`CONNECTION_ID()`: Return the current connection ID.
79
-
-`SOUNDEX(str)`: Returns the soundex of a string.
80
-
-`JSON_EXTRACT(json_doc, path, ...)`: Extracts data from a json document using json paths.
81
-
-`LN(X)`: Return the natural logarithm of X.
82
-
-`LOG2(X)`: Returns the base-2 logarithm of X.
83
-
-`LOG10(X)`: Returns the base-10 logarithm of X.
84
-
-`LOG(X), LOG(B, X)`: If called with one parameter, this function returns the natural logarithm of X. If called with two parameters, this function returns the logarithm of X to the base B. If X is less than or equal to 0, or if B is less than or equal to 1, then NULL is returned.
85
-
-`RPAD(str, len, padstr)`: Returns the string str, right-padded with the string padstr to a length of len characters.
86
-
-`LPAD(str, len, padstr)`: Return the string argument, left-padded with the specified string.
87
-
-`SQRT(X)`: Returns the square root of a nonnegative number X.
88
-
-`POW(X, Y)`, `POWER(X, Y)`: Returns the value of X raised to the power of Y.
89
-
-`TRIM(str)`: Returns the string str with all spaces removed.
90
-
-`LTRIM(str)`: Returns the string str with leading space characters removed.
91
-
-`RTRIM(str)`: Returns the string str with trailing space characters removed.
92
-
-`REVERSE(str)`: Returns the string str with the order of the characters reversed.
93
-
-`REPEAT(str, count)`: Returns a string consisting of the string str repeated count times.
94
-
-`REPLACE(str,from_str,to_str)`: Returns the string str with all occurrences of the string from_str replaced by the string to_str.
95
-
-`IFNULL(expr1, expr2)`: If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.
96
-
-`NULLIF(expr1, expr2)`: Returns NULL if expr1 = expr2 is true, otherwise returns expr1.
|`ARRAY_LENGTH(json)`|If the json representation is an array, this function returns its size.|
63
+
|`AVG(expr)`|Returns the average value of expr in all rows.|
64
+
|`CEIL(number)`|Return the smallest integer value that is greater than or equal to `number`.|
65
+
|`CEILING(number)`|Return the smallest integer value that is greater than or equal to `number`.|
66
+
|`COALESCE(...)`|The function returns the first non-null value in a list.|
67
+
|`CONCAT(...)`|Concatenate any group of fields into a single string.|
68
+
|`CONCAT_WS(sep, ...)`|Concatenate any group of fields into a single string. The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL.|
69
+
|`CONNECTION_ID()`|Return the current connection ID.|
70
+
|`COUNT(expr)`| Returns a count of the number of non-NULL values of expr in the rows retrieved by a SELECT statement.|
71
+
|`DAY(date)`|Returns the day of the given date.|
72
+
|`DAYOFWEEK(date)`|Returns the day of the week of the given date.|
73
+
|`DAYOFYEAR(date)`|Returns the day of the year of the given date.|
74
+
|`FLOOR(number)`|Return the largest integer value that is less than or equal to `number`.|
75
+
|`HOUR(date)`|Returns the hours of the given date.|
76
+
|`IFNULL(expr1, expr2)`|If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.|
77
+
|`IS_BINARY(blob)`|Returns whether a BLOB is a binary file or not.|
78
+
|`JSON_EXTRACT(json_doc, path, ...)`|Extracts data from a json document using json paths.|
79
+
|`LN(X)`|Return the natural logarithm of X.|
80
+
|`LOG(X), LOG(B, X)`|If called with one parameter, this function returns the natural logarithm of X. If called with two parameters, this function returns the logarithm of X to the base B. If X is less than or equal to 0, or if B is less than or equal to 1, then NULL is returned.|
81
+
|`LOG10(X)`|Returns the base-10 logarithm of X.|
82
+
|`LOG2(X)`|Returns the base-2 logarithm of X.|
83
+
|`LOWER(str)`|Returns the string str with all characters in lower case.|
84
+
|`LPAD(str, len, padstr)`|Return the string argument, left-padded with the specified string.|
85
+
|`LTRIM(str)`|Returns the string str with leading space characters removed.|
86
+
|`MAX(expr)`|Returns the maximum value of expr in all rows.|
87
+
|`MID(str, pos, [len])`|Return a substring from the provided string starting at `pos` with a length of `len` characters. If no `len` is provided, all characters from `pos` until the end will be taken.|
88
+
|`MIN(expr)`|Returns the minimum value of expr in all rows.|
89
+
|`MINUTE(date)`|Returns the minutes of the given date.|
90
+
|`MONTH(date)`|Returns the month of the given date.|
91
+
|`NOW()`|Returns the current timestamp.|
92
+
|`NULLIF(expr1, expr2)`|Returns NULL if expr1 = expr2 is true, otherwise returns expr1.|
93
+
|`POW(X, Y)`|Returns the value of X raised to the power of Y.|
94
+
|`REPEAT(str, count)`|Returns a string consisting of the string str repeated count times.|
95
+
|`REPLACE(str,from_str,to_str)`|Returns the string str with all occurrences of the string from_str replaced by the string to_str.|
96
+
|`REVERSE(str)`|Returns the string str with the order of the characters reversed.|
97
+
|`ROUND(number, decimals)`|Round the `number` to `decimals` decimal places.|
98
+
|`RPAD(str, len, padstr)`|Returns the string str, right-padded with the string padstr to a length of len characters.|
99
+
|`RTRIM(str)`|Returns the string str with trailing space characters removed.|
100
+
|`SECOND(date)`|Returns the seconds of the given date.|
101
+
|`SOUNDEX(str)`|Returns the soundex of a string.|
102
+
|`SPLIT(str,sep)`|Receives a string and a separator and returns the parts of the string split by the separator as a JSON array of strings.|
103
+
|`SQRT(X)`|Returns the square root of a nonnegative number X.|
104
+
|`SUBSTR(str, pos, [len])`|Return a substring from the provided string starting at `pos` with a length of `len` characters. If no `len` is provided, all characters from `pos` until the end will be taken.|
105
+
|`SUBSTRING(str, pos, [len])`|Return a substring from the provided string starting at `pos` with a length of `len` characters. If no `len` is provided, all characters from `pos` until the end will be taken.|
106
+
|`SUM(expr)`|Returns the sum of expr in all rows.|
107
+
|`TRIM(str)`|Returns the string str with all spaces removed.|
108
+
|`UPPER(str)`|Returns the string str with all characters in upper case.|
109
+
|`WEEKDAY(date)`|Returns the weekday of the given date.|
110
+
|`YEAR(date)`|Returns the year of the given date.|
111
+
<!-- END FUNCTIONS -->
97
112
98
113
## Configuration
99
114
@@ -105,25 +120,17 @@ Session variables are set using the following SQL queries:
105
120
SET<variable name>=<value>
106
121
```
107
122
108
-
### Memory joins
109
-
110
-
111
-
-`INMEMORY_JOINS`: if this environment variable is set it will perform all joins in memory. Default is off.
112
-
-`inmemory_joins`: if this session variable is set it will perform all joins in memory. Default is off. This has precedence over `INMEMORY_JOINS`.
113
-
114
-
### Maximum inner join memory
115
-
116
-
-`MAX_MEMORY_INNER_JOIN`: this environment variable controls in megabytes the maximum number of memory that can be consumed by go-mysql-server before switching to multipass mode in inner joins. Default is the 20% of all available physical memory.
117
-
-`max_memory_joins`: this session variable controls in megabytes the maximum number of memory that can be consumed by go-mysql-server before switching to multipass mode in inner joins. Default is the 20% of all available physical memory. This has precedence over `MAX_MEMORY_INNER_JOIN`.
118
-
119
-
### Debug
120
-
121
-
-`DEBUG_ANALYZER`: if this environment variable is set, the analyzer will print debug messages. Default is off.
122
-
123
-
### Index creation threads
124
-
125
-
-`PILOSA_INDEX_THREADS`: this environment variable sets the number of threads used in index creation. Default is the number of cores available in the machine.
126
-
-`pilosa_index_threads`: this session variable sets the number of threads used in index creation. Default is the number of cores available in the machine. This has precedence over `PILOSA_INDEX_THREADS`.
123
+
<!-- BEGIN CONFIG -->
124
+
| Name | Type | Description |
125
+
|:-----|:-----|:------------|
126
+
|`INMEMORY_JOINS`|environment|If set it will perform all joins in memory. Default is off.|
127
+
|`inmemory_joins`|session|If set it will perform all joins in memory. Default is off. This has precedence over `INMEMORY_JOINS`.|
128
+
|`MAX_MEMORY_INNER_JOIN`|environment|The maximum number of memory, in megabytes, that can be consumed by go-mysql-server before switching to multipass mode in inner joins. Default is the 20% of all available physical memory.|
129
+
|`max_memory_joins`|session|The maximum number of memory, in megabytes, that can be consumed by go-mysql-server before switching to multipass mode in inner joins. Default is the 20% of all available physical memory. This has precedence over `MAX_MEMORY_INNER_JOIN`.|
130
+
|`DEBUG_ANALYZER`|environment|If set, the analyzer will print debug messages. Default is off.|
131
+
|`PILOSA_INDEX_THREADS`|environment|Number of threads used in index creation. Default is the number of cores available in the machine.|
132
+
|`pilosa_index_threads`|environment|Number of threads used in index creation. Default is the number of cores available in the machine. This has precedence over `PILOSA_INDEX_THREADS`.|
0 commit comments