|
| 1 | +# GridDB CE 5.8 |
| 2 | + |
| 3 | +## Changes in V5.8 |
| 4 | + |
| 5 | +The main changes in GridDB CE version 5.8 are as follows: |
| 6 | + |
| 7 | +- SQL Optimization Enhancements |
| 8 | + |
| 9 | + Supported Join Optimization for the driving table, the inner table of SQL execution. The join plan can be generated with the cost-based method. |
| 10 | + |
| 11 | +- Timeseries-data Functionality Enhancements |
| 12 | + |
| 13 | + Supported moving average calculation for SQL analytic functions. And improved the accuracy of date arithmetic functions. |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## SQL Optimization Enhancements |
| 18 | + |
| 19 | +It is now possible to switch between cost-based and rule-based methods to select the driving table and the inner table for join operation, and this can be configured using the following: |
| 20 | +- Cluster definition file (gs_cluster.json) |
| 21 | +- Hint phase |
| 22 | + |
| 23 | +Using the cluster definition file (gs_cluster.json): |
| 24 | + |
| 25 | + * /sql/costBasedJoinDriving:Specifies whether to use the cost-based method for determining the driving table for join during SQL plan generation. If set to false, it uses the rule-based method. The default value is true, which indicates the cost-based method. |
| 26 | + |
| 27 | + |
| 28 | +Using the hint phase: |
| 29 | + |
| 30 | + * CostBasedJoinDriving():Use the cost-based method for determining the driving table for join. |
| 31 | + * NoCostBasedJoinDriving():Use the rule-based method for determining the driving table for join. |
| 32 | + |
| 33 | +## Timeseries-data Functionality Enhancements |
| 34 | + |
| 35 | +### Supported moving average calculation for SQL analytic functions |
| 36 | + |
| 37 | + |
| 38 | +Added FRAME clause for SQL analytic functions |
| 39 | + |
| 40 | +``` example |
| 41 | + function OVER ( [PARTITION BY expression1 ] [ ORDER BY expression2 ] [ FRAME-clause ] ) |
| 42 | +``` |
| 43 | + |
| 44 | +The syntax of FRAME-clause is as bellow: |
| 45 | + |
| 46 | +``` example |
| 47 | + ROWS | RANGE <FRAME-start-value> | BETWEEN <FRAME-start-value> AND <FRAME-end-value> |
| 48 | +``` |
| 49 | + |
| 50 | +The syntax of the start value and the end value of Frame is as bellow: |
| 51 | + |
| 52 | +``` example |
| 53 | + UNBOUNDED PRECEDING | UNBOUNDED FOLLOWING | CURRENT ROW | <Frame-boundary1> PRECEDING | <Frame-boundary2> FOLLOWING |
| 54 | +``` |
| 55 | + |
| 56 | +- CURRENT ROW: Specify the current row to be analyzed |
| 57 | +- UNBOUNDED: Specify the head or the tail of the partition |
| 58 | +- PRECEDING/FOLLOWING: Specify preceding or following |
| 59 | + |
| 60 | +The syntax of the boundary of Frame is as bellow: |
| 61 | + |
| 62 | +``` example |
| 63 | + value1 | ( value2, unit ) |
| 64 | +``` |
| 65 | + |
| 66 | +- The following functions can be specified the FRAME-clause. |
| 67 | + |
| 68 | + AVG、COUNT、MAX、MIN、SUM、TOTAL、STDDEV、VAR |
| 69 | + |
| 70 | +- The following functions can not be specified the FRAME-clause. |
| 71 | + |
| 72 | + ROW_NUMBER、LAG、LEAD |
| 73 | + |
| 74 | +例) |
| 75 | + |
| 76 | +Calculate the moving average for the previous 10 rows. |
| 77 | + |
| 78 | +``` example |
| 79 | +SELECT |
| 80 | + AVG(value1) |
| 81 | + OVER(ORDER BY time) |
| 82 | + ROWS BETWEEN 10 PRECEDING AND CURRENT ROW |
| 83 | +FROM tbl1; |
| 84 | +``` |
| 85 | + |
| 86 | +Calculate the moving average for the period up to 10 minutes prior to each row. |
| 87 | + |
| 88 | +``` example |
| 89 | +SELECT |
| 90 | + AVG(value1) |
| 91 | + OVER(ORDER BY time) |
| 92 | + RANGE BETWEEN (10, MINUTE) PRECEDING AND CURRENT ROW |
| 93 | +FROM tbl1; |
| 94 | +``` |
| 95 | + |
| 96 | +### Improved the accuracy of date arithmetic functions |
| 97 | + |
| 98 | +Added the following functions for SQL and TQL(query language for NoSQL Interface). |
| 99 | + |
| 100 | +- SQL |
| 101 | +``` example |
| 102 | + * TIMESTAMP_MS(timestamp_string [, timezone]):Converts a string representation of the time to a TIMESTAMP(3) type with millisecond precision. |
| 103 | + * TIMESTAMP_US(timestamp_string [, timezone]):Converts a string representation of the time to a TIMESTAMP(6) type with microsecond precision. |
| 104 | + * TIMESTAMP_NS(timestamp_string [, timezone]):Converts a string representation of the time to a TIMESTAMP(9) type with nanosecond precision. |
| 105 | +``` |
| 106 | + |
| 107 | +- TQL |
| 108 | +``` example |
| 109 | + * TIMESTAMP_MS(str):Converts a string representation of the time to a TIMESTAMP(3) type with millisecond precision. |
| 110 | + * TIMESTAMP_US(str):Converts a string representation of the time to a TIMESTAMP(6) type with microsecond precision. |
| 111 | + * TIMESTAMP_NS(str):Converts a string representation of the time to a TIMESTAMP(9) type with nanosecond precision. |
| 112 | +``` |
| 113 | + |
| 114 | +And The following functions now support calculations with microsecond and nanosecond precision: |
| 115 | + |
| 116 | +- SQL |
| 117 | +``` example |
| 118 | + * TIMESTAMP_ADD(time_unit, timestamp, duration [, timezone])/TIMESTAMP_DIFF(time_unit, timestamp1, timestamp2 [, timezone]) |
| 119 | +``` |
| 120 | + |
| 121 | +- TQL |
| 122 | +``` example |
| 123 | + * TIMESTAMPADD(time_unit, timestamp, duration)/TIMESTAMPDIFF(time_unit, timestamp1, timestamp2) |
| 124 | + Note: We have also added TIMESTAMP_ADD()/TIMESTAMP_DIFF(), which have the same names as the SQL functions. |
| 125 | +``` |
| 126 | + |
0 commit comments