-
Notifications
You must be signed in to change notification settings - Fork 546
/
5.4.0.rst
248 lines (163 loc) · 7.8 KB
/
5.4.0.rst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
.. _version_5.4.0:
=============
Version 5.4.0
=============
Released on 2023-07-11.
.. NOTE::
If you are upgrading a cluster, you must be running CrateDB 4.0.2 or higher
before you upgrade to 5.4.0.
We recommend that you upgrade to the latest 5.3 release before moving to
5.4.0.
A rolling upgrade from 5.3.x to 5.4.0 is supported.
Before upgrading, you should `back up your data`_.
.. WARNING::
Tables that were created before CrateDB 4.x will not function with 5.x
and must be recreated before moving to 5.x.x.
You can recreate tables using ``COPY TO`` and ``COPY FROM`` or by
`inserting the data into a new table`_.
.. _back up your data: https://crate.io/docs/crate/reference/en/latest/admin/snapshots.html
.. _inserting the data into a new table: https://crate.io/docs/crate/reference/en/latest/admin/system-information.html#tables-need-to-be-recreated
.. rubric:: Table of Contents
.. contents::
:local:
Known Issues
============
- Version 5.0.0 introduced a regression which can cause some ``JOIN`` queries
to return no results when the query optimizer re-orders the joined tables.
As a workaround, users should apply the following session settings before
running such queries to prevent the query optimizer from re-ordering them
and therefore produce the correct results:
On CrateDB >= 5.4.0::
SET optimizer_reorder_hash_join = false
SET optimizer_reorder_nested_loop_join = false
On CrateDB < 5.4.0 (this will disable the hash-join algorithm which may lead
to poor performance)::
SET enable_hashjoin = false
Breaking Changes
================
- Implemented several changes to the ``pg_catalog`` tables, involving the
addition and removal of columns, and modification of column data types, to
align with PostgreSQL version 14:
- ``pg_attribute``
- **Added**: ``atthasmissing``, ``attmissingval``
- **Type Changed**: ``spcacl`` from ``OBJECT[]`` to ``STRING[]``
- ``pg_class``
- **Added**: ``relrewrite``
- **Removed**: ``relhasoids``, ``relhaspkey``
- **Type Changed**: ``relacl`` from ``OBJECT[]`` to ``STRING[]``
- ``pg_constraint``
- **Added**: ``conparentid``
- **Removed**: ``consrc``
- **Type Changed**: ``conbin`` from ``OBJECT`` to ``STRING``
- ``pg_index``
- **Added**: ``indnkeyatts``
- ``pg_namespace``
- **Type Changed**: ``nspacl`` from ``OBJECT[]`` to ``STRING[]``
- ``pg_proc``
- **Added**: ``prokind``, ``prosqlbody``, ``prosupport``
- **Removed**: ``proisagg``, ``proiswindow``, ``protransform``
- **Type Changed**: ``proargdefaults`` from ``OBJECT[]`` to ``STRING``
- ``pg_type``
- **Added**: ``typacl``, ``typalign``, ``typanalyze``,
``typdefaultbin``, ``typmodin``, ``typmodout``, ``typstorage``,
``typsubscript``
- Raise an exception if duplicate columns are detected on
:ref:`named index column definition <named-index-column>` instead of
silently ignoring them.
- Adjusted allowed array index range to be from ``Integer.MIN_VALUE`` to
``Integer.MAX_VALUE``. The behavior is now also consistent between subscripts
on array literals and on columns, and between index literals and index
expressions. That means something like ``tags[-1]`` will now return ``NULL``
just like ``ARRAY['AUT', 'GER'][-1]`` or ``ARRAY['AUT', 'GER'][1 - 5]`` did.
Deprecations
============
None
Changes
=======
SQL Statements
--------------
- Extended the :ref:`EXPLAIN <ref-explain>` statement output to include the
estimated row count in the output of the execution plan. The statement also
has now options for `ANALYZE` and `COSTS` to have better control on
the generated output plan.
SQL Standard and PostgreSQL Compatibility
-----------------------------------------
- Bumped the version of PostgreSQL wire protocol to ``14`` since ``10`` has been
deprecated.
- Added ``any_value`` as an alias to the ``arbitrary`` aggregation function, for
compliance with the SQL2023 standard. Extended the aggregations to support any
type.
- Changed literal :ref:`INTERVAL data type <type-interval>` to do normalization
up to day units, and comply with PostgreSQL behavior, e.g.::
cr> SELECT INTERVAL '1 month 42 days 126 hours 512 mins 7123 secs';
+------------------------------+
| 'P1M47DT16H30M43S'::interval |
+------------------------------+
| 1 mon 47 days 16:30:43 |
+------------------------------+
- Added ``attgenerated`` column to ``pg_catalog.pg_attribute`` table which
returns ``''`` (empty string) for normal columns and ``'s'`` for
:ref:`generated columns <ddl-generated-columns>`.
- Added the ``pg_catalog.pg_cursors`` table to expose open cursors.
- Added the
:ref:`standard_conforming_strings <conf-session-standard_conforming_strings>`
read-only session setting for improved compatibility with PostgreSQL clients.
- Allow casts in both forms: ``CAST(<literal or parameter> AS <datatype>)`` and
``<literal or parameter>::<datatype>`` for ``LIMIT`` and ``OFFSET`` clauses,
e.g.::
SELECT * FROM test OFFSET CAST(? AS long) LIMIT '20'::int
- Added support for ``ORDER BY``, ``MAX``, ``MIN`` and comparison operators on
expressions of type ``INTERVAL``.
- Added support for setting session settings via a ``"options"`` property in the
startup message for PostgreSQL wire protocol clients.
An example for JDBC::
Properties props = new Properties();
props.setProperty("options", "-c statement_timeout=90000");
Connection conn = DriverManager.getConnection(url, props);
- Added support for underscores in numeric literals. Example::
SELECT 1_000_000;
- Added support for updating arrays by elements, e.g.::
UPDATE t SET a[1] = 2 WHERE id = 1;
- Array comparisons like ``= ANY`` will now automatically unnest the array
argument to the required dimensions.
An example::
cr> SELECT 1 = ANY([ [1, 2], [3, 4] ]); -- automatic unnesting
True
cr> SELECT [1] = ANY([ [1, 2], [3, 4] ]); -- no unnesting
False
Scalar and Aggregation Functions
--------------------------------
- Added support for :ref:`AVG() aggregation <aggregation-avg>` on
:ref:`INTERVAL data type <type-interval>`.
- Added a :ref:`array_unnest <scalar-array_unnest>` scalar function.
- Added a :ref:`btrim <scalar-btrim>` scalar function.
- Added :ref:`array_set <scalar-array_set>` scalar function.
Performance and Resilience Improvements
---------------------------------------
- Improved the partition filtering logic to also narrow partitions if the
partition is based on a generated column using the :ref:`date_bin <date-bin>`
scalar.
- Improved ``COPY FROM`` retry logic to retry with a delay which increases
exponentially on temporary network timeout and general network errors.
Data Types
----------
- Added support to disable :ref:`column storage <ddl-storage-columnstore>` for
:ref:`numeric data types <data-types-numeric>`,
:ref:`timestamp <type-timestamp>` and
:ref:`timestamp with timezone<type-timestamp-with-tz>`.
Administration and Operations
-----------------------------
- Added optimizer rules for reordering of joins for hash and nested-loop joins.
This allows now to control the join-reordering and disable it, if desired, with
session settings::
SET optimizer_reorder_hash_join = false
SET optimizer_reorder_nested_loop_join = false
Note that these settings are experimental, and may change in the future.
- Added a :ref:`statement_timeout <conf-session-statement-timeout>` session
setting and :ref:`cluster setting <statement_timeout>` that allows to set a
timeout for queries.
- The severity of the node checks on the metadata gateway recovery settings
has been lowered from `HIGH` to `MEDIUM` as leaving these to default
or suboptimal values does not translate into data corruption or loss.
- Added the ability to set a
:ref:`storage_class <sql-create-repo-s3-storage_class>` for S3 repositories.