<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: tongxi</title>
    <description>The latest articles on DEV Community by tongxi (@tongxi99658318).</description>
    <link>https://dev.to/tongxi99658318</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1030808%2F5bf18347-6844-411b-b9e6-a412cd3e0d90.png</url>
      <title>DEV Community: tongxi</title>
      <link>https://dev.to/tongxi99658318</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tongxi99658318"/>
    <language>en</language>
    <item>
      <title>openGauss dolphin-bit-string-types</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Sun, 23 Apr 2023 02:38:36 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengaussdolphin-bit-string-types-59on</link>
      <guid>https://dev.to/tongxi99658318/opengaussdolphin-bit-string-types-59on</guid>
      <description>&lt;p&gt;Compared with the original openGauss, Dolphin modifies the bit string types as follows:&lt;/p&gt;

&lt;p&gt;The data of the bit type is of variable length up to the maximum length n. Longer strings will be rejected. The data of the bit varying type is of variable length up to the maximum length n. Longer strings will be rejected.&lt;br&gt;
If one explicitly casts a bit-string value to bit(n), it will be truncated or zero-padded on the left to be exactly n bits, without raising an error.&lt;br&gt;
""&lt;br&gt;
--Create a table.&lt;br&gt;
openGauss=# CREATE TABLE bit_type_t1 &lt;br&gt;
(&lt;br&gt;
    BT_COL1 INTEGER,&lt;br&gt;
    BT_COL2 BIT(3),&lt;br&gt;
    BT_COL3 BIT VARYING(5)&lt;br&gt;
) ;&lt;/p&gt;

&lt;p&gt;--Data is converted if it exceeds the length of this data type.&lt;br&gt;
openGauss=# INSERT INTO bit_type_t1 VALUES(2, B'1000'::bit(3), B'101');&lt;/p&gt;

&lt;p&gt;--View data.&lt;br&gt;
openGauss=# SELECT * FROM bit_type_t1;&lt;br&gt;
 bt_col1 | bt_col2 | bt_col3 &lt;br&gt;
---------+---------+---------&lt;br&gt;
       2 | 100     | 101&lt;br&gt;
(2 rows)&lt;/p&gt;

&lt;p&gt;--If the length of a character string is insufficient, the character string is converted to bit(n) and zeros are padded on the left.&lt;br&gt;
openGauss=# SELECT B'10'::bit(4);&lt;/p&gt;

&lt;h2&gt;
  
  
    bit   
&lt;/h2&gt;

&lt;p&gt;000010&lt;br&gt;
(1 row)&lt;/p&gt;

&lt;p&gt;--Delete a table.&lt;br&gt;
openGauss=# DROP TABLE bit_type_t1;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss M*-Compatible Time Types</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Sun, 23 Apr 2023 02:37:51 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-m-compatible-time-types-3cdn</link>
      <guid>https://dev.to/tongxi99658318/opengauss-m-compatible-time-types-3cdn</guid>
      <description>&lt;p&gt;Compared with the original openGauss, Dolphin modifies the date/time types as follows:&lt;/p&gt;

&lt;p&gt;The performance of the date, time, datetime, and timestamp types are modified.&lt;br&gt;
The year data type is added.&lt;br&gt;
Note: Due to the inherent features of the openGauss, the openGauss cannot be fully compatible with all features of the M* time data type. Therefore, you need to use the features according to the requirements in this document. Do not use the features that are not described in this document. In addition, the compatible features cover the requirements in most scenarios.&lt;/p&gt;

&lt;p&gt;The following table lists the basic attributes after the time data type is compatible with the M* database.&lt;/p&gt;

&lt;p&gt;Type    Description Storage Space   Value Range (for Users) Precision Range Remarks&lt;br&gt;
date    Indicates a date.   4 bytes 4713 BC ~ 5874897 AD    -   (1) The input must be a valid date. The month or number of days cannot be 0. (2) If the year is greater than or equal to 10000, the value must be in the YYYY-MM-DD format. (3) If BC or AD is not specified for the input data, AD is used by default.&lt;br&gt;
time(p) Indicates the time or a period of time (hours, minutes, and seconds) of a day. p indicates the precision.   8 bytes -838:59:59[.frac] ~ 838:59:59[.frac]    p indicates the precision after the decimal point. The value ranges from 0 to 6. If this parameter is not specified, the default value 0 is used.   -&lt;br&gt;
datetime(p) Indicates date and time without time zone information. p indicates the precision.   8 bytes 0 AD ~ 294276 AD    p indicates the precision after the decimal point. The value ranges from 0 to 6. If this parameter is not specified, the default value 0 is used.   (1) The input must be a valid date. The month or number of days cannot be 0. (2) If the entered year is greater than or equal to 10000, the year must be in the YYYY-MM-DD format.&lt;br&gt;
timestamp(p)    Date and time with time zone information. p indicates the precision.    8 bytes 0 AD ~ 294276 AD    p indicates the precision after the decimal point. The value ranges from 0 to 6. If this parameter is not specified, the default value 0 is used.   (1) The input must be a valid date. The month or number of days cannot be 0. (2) Note that the timestamp type in the original openGauss database indicates a timestamp without a time zone. After compatibility, the timestamp type is close to the M* database, indicating a timestamp with a time zone. Therefore, compatibility issues exist. (3) If the entered year is greater than or equal to 10000, the year must be in the YYYY-MM-DD format.&lt;br&gt;
year(w) Indicates a year. w indicates the display width. The value of year(4) or year is in the YYYY format, and the value of year(2) is in the YY format.  2 bytes 1901 ~ 2155 -   -&lt;br&gt;
Remarks&lt;/p&gt;

&lt;p&gt;Note that, for M*, in the CREATE TABLE or ALTER TABLE statement, if the precision is not specified when the time type (such as timestamp, datetime, and time) column attribute is defined, the default value 0 is used. When the cast(expr as typename) syntax is used for type conversion, if no precision is specified for the target type, the default precision is 0. Therefore, if you want to retain the input precision of the data, you need to explicitly use typmod.&lt;br&gt;
In addition, :: is used to convert the compatible time type. If no precision is specified for the target type, the default precision is 0.&lt;br&gt;
Date Type Inputs&lt;br&gt;
The following formats are supported:&lt;/p&gt;

&lt;p&gt;Format  Description&lt;br&gt;
'YYYY-MM-DD' , 'YY-MM-DD'   Year, month, and date&lt;br&gt;
'YYYYMMDD', 'YYMMDD'    Year, month, and date&lt;br&gt;
YYYYMMDD, YYMMDD    Year, month, and date&lt;br&gt;
Remarks:&lt;/p&gt;

&lt;p&gt;The input must be a valid date. The month or date cannot be 0.&lt;br&gt;
The original value range of M* is within 10000. Therefore, if you want to enter a date greater than or equal to 10000, use the YYYY-MM-DD format, for example, '10100-12-12'.&lt;br&gt;
Year 0000 is allowed. In addition, in openGauss, year 0000 is considered a leap year. You can enter 0000-2-29 (M* not allowed).&lt;br&gt;
Examples (Note that openGauss is compatible with B database.)&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table.&lt;br&gt;
openGauss=# CREATE TABLE test_date(&lt;br&gt;
openGauss(# dt date);&lt;br&gt;
CREATE TABLE&lt;/p&gt;

&lt;p&gt;--Insert data.&lt;br&gt;
openGauss=# INSERT INTO test_date VALUES ('2020-12-21');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_date VALUES ('141221');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_date VALUES (20151022);&lt;br&gt;
INSERT 0 1&lt;/p&gt;

&lt;p&gt;--View data.&lt;br&gt;
openGauss=# SELECT * FROM test_date;&lt;/p&gt;

&lt;h2&gt;
  
  
       dt     
&lt;/h2&gt;

&lt;p&gt;2020-12-21&lt;br&gt;
 2014-12-21&lt;br&gt;
 2015-10-22&lt;br&gt;
(3 rows)&lt;br&gt;
Time Type Inputs&lt;br&gt;
The following formats are supported:&lt;/p&gt;

&lt;p&gt;Format  Description&lt;br&gt;
'[-][D] hh:mm:ss[.frac]'    Indicates the hour, minute, and second. The value can be a negative number. D indicates the number of days. The value ranges from 0 to 34.&lt;br&gt;
'[-]hhmmss[.frac]'  Hour, minute, and second&lt;br&gt;
[-]hhmmss[.frac]    Hour, minute, and second&lt;br&gt;
Remarks:&lt;/p&gt;

&lt;p&gt;For the format 'hh:mm:ss', the loose input formats 'hh:mm' and 'ss' are also supported.&lt;br&gt;
When the integer 0 is entered, the value is 00:00:00, which is also a zero value of the time type.&lt;br&gt;
After the time type is compatible, the value range can be greater than 24 hours. Do not convert the time type to the timetz type.&lt;br&gt;
Examples (Note that openGauss is compatible with B database.)&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table.&lt;br&gt;
openGauss=# CREATE TABLE test_time(&lt;br&gt;
openGauss(# ti time(2));&lt;br&gt;
CREATE TABLE&lt;/p&gt;

&lt;p&gt;--Insert data.&lt;br&gt;
openGauss=# INSERT INTO test_time VALUES ('2 9:12:24.1234');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_time VALUES ('-34:56:59.1234');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_time VALUES (561234);&lt;br&gt;
INSERT 0 1&lt;/p&gt;

&lt;p&gt;--View data.&lt;br&gt;
openGauss=# SELECT * FROM test_time;&lt;/p&gt;

&lt;h2&gt;
  
  
        ti      
&lt;/h2&gt;

&lt;p&gt;57:12:24.12&lt;br&gt;
 -34:56:59.12&lt;br&gt;
 56:12:34&lt;br&gt;
(3 rows)&lt;br&gt;
Datetime Type Inputs&lt;br&gt;
The following formats are supported:&lt;/p&gt;

&lt;p&gt;Format  Description&lt;br&gt;
'YYYY-MM-DD hh:mm:ss[.frac]', 'YY-MM-DD hh:mm:ss[.frac]'    Timestamp&lt;br&gt;
'YYYYMMDDhhmmss', 'YYMMDDhhmmss'    Timestamp&lt;br&gt;
YYYYMMDDhhmmss, YYMMDDhhmmss    Timestamp&lt;br&gt;
Remarks:&lt;/p&gt;

&lt;p&gt;The input must be a valid date. The month or date cannot be 0.&lt;br&gt;
For the YYYYMMDDhhmmss and YYMMDDhhmmss formats, the first four letters of the character string are identified as the year only when the length of the character string is 8 or 14. In other cases, only the first two letters are identified as the year.&lt;br&gt;
If the input format is YYYYMMDDhhmmss or YYMMDDhhmmss, the length of the input integer must be 6, 8, 12, or 14. If the length does not meet this requirement, zeros are added before the integer, if the length is 6, 8, 12, or 14, the value is in the YYMMDD format. If the length is 8, the value is in the YYYYMMDD format. If the length is 12, the value is in the YYMMDDhhmmss format. If the length is 14, the value is in the YYYYMMDDhhmmss format.&lt;br&gt;
If you want to enter a timestamp whose year is greater than or equal to 10000, use the 'YYYY-MM-DD hh:mm:ss[.frac]' format.&lt;br&gt;
Examples (Note that openGauss is compatible with B database.)&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table.&lt;br&gt;
openGauss=# CREATE TABLE test_datetime(&lt;br&gt;
openGauss(# dt datetime(2));&lt;br&gt;
CREATE TABLE&lt;/p&gt;

&lt;p&gt;--Insert data.&lt;br&gt;
openGauss=# INSERT INTO test_datetime VALUES ('2020-11-08 02:31:25.961');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_datetime VALUES (201112234512);&lt;br&gt;
INSERT 0 1&lt;/p&gt;

&lt;p&gt;--View data.&lt;br&gt;
openGauss=# SELECT * FROM test_datetime;&lt;/p&gt;

&lt;h2&gt;
  
  
             dt           
&lt;/h2&gt;

&lt;p&gt;2020-11-08 02:31:25.96&lt;br&gt;
 2020-11-12 23:45:12&lt;br&gt;
(3 rows)&lt;br&gt;
Timestamp Type Inputs&lt;br&gt;
The following formats are supported:&lt;/p&gt;

&lt;p&gt;Format  Description&lt;br&gt;
'YYYY-MM-DD hh:mm:ss[.frac][+/-hh:mm:ss]', 'YY-MM-DD hh:mm:ss[.frac][+/-hh:mm:ss]'  Timestamp with time zone&lt;br&gt;
'YYYYMMDDhhmmss[.frac]', 'YYMMDDhhmmss[.frac]'  Timestamp with time zone&lt;br&gt;
YYYYMMDDhhmmss[.frac], YYMMDDhhmmss[.frac]  Timestamp with time zone&lt;br&gt;
Remarks:&lt;/p&gt;

&lt;p&gt;The input must be a valid date. The month or date cannot be 0.&lt;br&gt;
The compatible timestamp type allows the time zone information [+/-hh:mm:ss] to be added after the format 'YYYY-MM-DD hh:mm:ss[.frac]'.&lt;br&gt;
If you want to enter a timestamp whose year is greater than or equal to 10000, use the 'YYYY-MM-DD hh:mm:ss[.frac]' format.&lt;br&gt;
Note that the timestamp type in the M* database is a timestamp without the time zone, and that in openGauss is a timestamp with the time zone. After compatibility, the timestamp type is stored in the timestamptz type internally. Note that the timestamp type is stored in the timestamptz type. Pay attention to the difference before using the timestamp type. If you want to use a timestamp without a time zone, use the datetime type.&lt;br&gt;
Note: The M* does not have the timestamp with[out] time zone syntax, but we still retain this syntax in openGauss. The timestamp with time zone is equivalent to the original openGauss timestamptz type, and timestamp without time zone is equivalent to the timestamp type in the original openGauss (not the compatible timestamp type, that is, the original timestamp without time zone).&lt;br&gt;
Examples (Note that openGauss is compatible with B database.)&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table.&lt;br&gt;
openGauss=# CREATE TABLE test_timestamp(&lt;br&gt;
openGauss(# ts timestamp(2));&lt;br&gt;
CREATE TABLE&lt;/p&gt;

&lt;p&gt;--Insert data.&lt;br&gt;
openGauss=# INSERT INTO test_timestamp VALUES ('2012-10-21 23:55:23-12:12');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_timestamp VALUES (201112234512);&lt;br&gt;
INSERT 0 1&lt;/p&gt;

&lt;p&gt;--View data.&lt;br&gt;
openGauss=# SELECT * FROM test_timestamp;&lt;/p&gt;

&lt;h2&gt;
  
  
             ts           
&lt;/h2&gt;

&lt;p&gt;2012-10-22 20:07:23&lt;br&gt;
 2020-11-12 23:45:12&lt;br&gt;
(3 rows)&lt;/p&gt;

&lt;p&gt;--Change the time zone.&lt;br&gt;
openGauss=# SET TIME ZONE UTC;&lt;br&gt;
SET&lt;br&gt;
--View data.&lt;br&gt;
openGauss=# SELECT * FROM test_timestamp;&lt;/p&gt;

&lt;h2&gt;
  
  
             ts           
&lt;/h2&gt;

&lt;p&gt;2012-10-22 12:07:23&lt;br&gt;
 2020-11-12 15:45:12&lt;br&gt;
(3 rows)&lt;br&gt;
Input of the year/year(4) or year(2) type&lt;br&gt;
The following formats are supported:&lt;/p&gt;

&lt;p&gt;Format  Description&lt;br&gt;
'YYYY', 'YY'    Indicates a year. When you enter two digits, if the value is less than 70, add 2000 to the value. For example, 69 indicates 2069. If the value is greater than or equal to 70, add 1900 to the value. For example, 70 indicates 1970.&lt;br&gt;
YYYY, YY    Year&lt;br&gt;
Remarks&lt;/p&gt;

&lt;p&gt;The three types accept the same input format and range. The only difference is that the output format of the year(2) type is only two digits.&lt;br&gt;
If '0' is entered, openGauss will parse the value to the year 2000. However, if an integer 0 is entered, openGauss will parse the value to 0, indicating the value 0 of the year type.&lt;br&gt;
Examples (Note that openGauss is compatible with B database.)&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table.&lt;br&gt;
openGauss=# CREATE TABLE test_year(&lt;br&gt;
openGauss(#  y year,&lt;br&gt;
openGauss(#  y2 year(2));&lt;br&gt;
CREATE TABLE&lt;/p&gt;

&lt;p&gt;--Insert data.&lt;br&gt;
openGauss=# INSERT INTO test_year VALUES ('70', '70');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_year VALUES ('69', '69');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_year VALUES ('2069', '2069');&lt;br&gt;
INSERT 0 1&lt;br&gt;
openGauss=# INSERT INTO test_year VALUES ('1970', '1970');&lt;br&gt;
INSERT 0 1&lt;/p&gt;

&lt;p&gt;--View data.&lt;br&gt;
openGauss=# SELECT * FROM test_year;&lt;br&gt;
  y   | y2 &lt;br&gt;
------+----&lt;br&gt;
 1970 | 70&lt;br&gt;
 2069 | 69&lt;br&gt;
 2069 | 69&lt;br&gt;
 1970 | 70&lt;br&gt;
(4 rows)&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss dolphin-character-types</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Sun, 23 Apr 2023 02:36:51 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-dolphin-character-types-22i3</link>
      <guid>https://dev.to/tongxi99658318/opengauss-dolphin-character-types-22i3</guid>
      <description>&lt;p&gt;Compared with the original openGauss, Dolphin modifies the character types as follows:&lt;/p&gt;

&lt;p&gt;The meaning of n of the CHARACTER/NCHAR type is modified. n indicates the character length instead of the byte length.&lt;br&gt;
During comparison of all character data types, spaces at the end are ignored, for example, in the WHERE and JOIN scenarios. For example, 'a'::text = 'a'::text is true. For the VARCHAR, VARCHAR2, NVARCHAR2, NVARCHAR, TEXT, and CLOB types, HASH JOIN and HASH AGG ignore spaces at the end only when string_hash_compatible is set to on.&lt;br&gt;
The optional modifier (n) is added for TEXT. That is, the usage of TEXT(n) is supported. n is meaningless and does not affect any performance.&lt;br&gt;
The TINYTEXT(n)/MEDIUMTEXT(n)/LONGTEXT(n) data type is added, which is the alias of TEXT. n is meaningless and does not affect any performance.&lt;br&gt;
Table 1 Character types&lt;/p&gt;

&lt;p&gt;Name&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;Storage Space&lt;/p&gt;

&lt;p&gt;CHAR(n)&lt;/p&gt;

&lt;p&gt;CHARACTER(n)&lt;/p&gt;

&lt;p&gt;NCHAR(n)&lt;/p&gt;

&lt;p&gt;Character string with fixed length. Empty characters are filled in with blank spaces. &lt;strong&gt;n&lt;/strong&gt; indicates the string length. If it is not specified, the default precision &lt;strong&gt;1&lt;/strong&gt; is used.&lt;/p&gt;

&lt;p&gt;The maximum size is 10 MB.&lt;/p&gt;

&lt;p&gt;TEXT(n),&lt;/p&gt;

&lt;p&gt;TINYTEXT(n),&lt;/p&gt;

&lt;p&gt;MEDIUMTEXT(n),&lt;/p&gt;

&lt;p&gt;LONGTEXT(n)&lt;/p&gt;

&lt;p&gt;Character string with variable length. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;The maximum size is 1 GB - 1 byte. However, the size of the column description header and the size of the tuple (less than 1 GB - 1 byte) where the column is located must also be considered. Therefore, the maximum size of the TEXT type may be less than 1 GB - 1 byte.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table.&lt;br&gt;
openGauss=# CREATE TABLE char_type_t1 &lt;br&gt;
(&lt;br&gt;
    CT_COL1 CHARACTER(4),&lt;br&gt;
    CT_COL2 TEXT(10),&lt;br&gt;
    CT_COL3 TINYTEXT(11),&lt;br&gt;
    CT_COL4 MEDIUMTEXT(12),&lt;br&gt;
    CT_COL5 LONGTEXT(13)&lt;br&gt;
);&lt;/p&gt;

&lt;p&gt;--View a table structure.&lt;br&gt;
openGauss=# \d char_type_t1 &lt;br&gt;
    Table "public.char_type_t1"&lt;br&gt;
 Column  |     Type     | Modifiers&lt;br&gt;
---------+--------------+-----------&lt;br&gt;
 ct_col1 | character(4) |&lt;br&gt;
 ct_col2 | text         |&lt;br&gt;
 ct_col3 | text         |&lt;br&gt;
 ct_col4 | text         |&lt;br&gt;
 ct_col5 | text         |&lt;/p&gt;

&lt;p&gt;--Insert data.&lt;br&gt;
openGauss=# INSERT INTO char_type_t1 VALUES ('Four characters');&lt;br&gt;
openGauss=# INSERT INTO char_type_t1 VALUES('e   ');&lt;/p&gt;

&lt;p&gt;--View data.&lt;br&gt;
openGauss=# SELECT CT_COL1,length(CT_COL1) FROM char_type_t1;&lt;br&gt;
 ct_col1  | length&lt;br&gt;
----------+--------&lt;br&gt;
 Four characters | 4&lt;br&gt;
 e        |      1&lt;br&gt;
(2 rows)&lt;/p&gt;

&lt;p&gt;--Filter data.&lt;br&gt;
openGauss=# SELECT CT_COL1 FROM char_type_t1 WHERE CT_COL1 = 'e';&lt;/p&gt;

&lt;h2&gt;
  
  
   ct_col1
&lt;/h2&gt;

&lt;p&gt;e&lt;br&gt;
(1 row)&lt;/p&gt;

&lt;p&gt;openGauss=# SELECT CT_COL1 FROM char_type_t1 WHERE CT_COL1 = 'e ';&lt;/p&gt;

&lt;h2&gt;
  
  
   ct_col1
&lt;/h2&gt;

&lt;p&gt;e&lt;br&gt;
(1 row)&lt;/p&gt;

&lt;p&gt;--Delete the table.&lt;br&gt;
openGauss=# DROP TABLE char_type_t1;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss dolphin-numeric-types</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Sun, 23 Apr 2023 02:36:02 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-dolphin-numeric-types-f5d</link>
      <guid>https://dev.to/tongxi99658318/opengauss-dolphin-numeric-types-f5d</guid>
      <description>&lt;p&gt;For details about arithmetic operators and related built-in functions, see Arithmetic Functions and Operators.&lt;/p&gt;

&lt;p&gt;Compared with the original openGauss, Dolphin modifies the arithmetic types as follows:&lt;/p&gt;

&lt;p&gt;The INT, TINYINT, SMALLINT, and BIGINT support the optional modifier (n), that is, the usage of TINYINT(n), SMALLINT(n), and BIGINT(n) is supported. n is meaningless and does not affect any performance.&lt;br&gt;
The MEDIUMINT(n) data type is added, which is the alias of INT4. n is meaningless and does not affect any performance. The storage space is 4 bytes, and the data ranges from -2,147,483,648 to +2,147,483,647.&lt;br&gt;
The FIXED[(p[,s])] data type is added, which is the alias of the NUMERIC type. The precision is specified by users. Two bytes are occupied for every four decimals of precision. An extra eight-byte overhead is added for numbers of this type. Up to 131,072 digits before the decimal point and up to 16,383 digits after the decimal point when no precision is specified&lt;br&gt;
The float4(p[,s]) mode is added, which is equivalent to dec(p[,s]).&lt;br&gt;
The double data type is added, which is the alias of float8.&lt;br&gt;
The new float4 and float support the modifier (n). That is, float4(n) and float(n) are supported. When the value range of n is [1,24], float4(n) and float(n) indicate a single-precision floating point number. If the value range of n is [25,53], float4(n) and float(n) indicate a double-precision floating point number.&lt;br&gt;
For the decimal, dec, fixed, and numeric data types, if the precision is not specified, the default precision is (10,0). That is, the total number of digits is 10 and the number of decimal places is 0.&lt;br&gt;
The UNSIGNED INT, TINYINT, SMALLINT, and BIGINT types are added. Compared with a common integer, the most significant bit of the UNSIGNED INT, TINYINT, SMALLINT, BIGINT type is a digit bit instead of a sign bit.&lt;br&gt;
The zerofill attribute is added, which is supported only in syntax and does not have the effect of filling zeros. It is equivalent to UNSIGNED.&lt;br&gt;
The cast function parameters SIGNED and UNSIGNED are added. CAST AS UNSIGNED converts the type to uint8, and CAST AS SIGNED converts the type to int8.&lt;br&gt;
Table 1 Integer types&lt;/p&gt;

&lt;p&gt;Alias of theAlias of the&lt;br&gt;
Name&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;Storage Space&lt;/p&gt;

&lt;p&gt;Value Range&lt;/p&gt;

&lt;p&gt;TINYINT(n)&lt;/p&gt;

&lt;p&gt;Tiny integer, also called INT1. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;1 byte&lt;/p&gt;

&lt;p&gt;-128 to +127&lt;/p&gt;

&lt;p&gt;SMALLINT(n)&lt;/p&gt;

&lt;p&gt;Small integer, also called INT2. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;2 bytes&lt;/p&gt;

&lt;p&gt;-32,768 ~ +32,767&lt;/p&gt;

&lt;p&gt;INTEGER(n)&lt;/p&gt;

&lt;p&gt;Typical choice for integers, also called INT4. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;4 bytes&lt;/p&gt;

&lt;p&gt;-2,147,483,648 ~ +2,147,483,647&lt;/p&gt;

&lt;p&gt;MEDIUMINT(n)&lt;/p&gt;

&lt;p&gt;Alias of INT4. &lt;strong&gt;n&lt;/strong&gt; is meaningless and does not affect any performance.&lt;/p&gt;

&lt;p&gt;4 bytes&lt;/p&gt;

&lt;p&gt;-2,147,483,648 ~ +2,147,483,647&lt;/p&gt;

&lt;p&gt;BIGINT(n)&lt;/p&gt;

&lt;p&gt;Big integer, also called INT8. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;8 bytes&lt;/p&gt;

&lt;p&gt;-9,223,372,036,854,775,808 ~ +9,223,372,036,854,775,807&lt;/p&gt;

&lt;p&gt;TINYINT(n) UNSIGNED&lt;/p&gt;

&lt;p&gt;Tiny integer, also called INT1. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;1 byte&lt;/p&gt;

&lt;p&gt;0 ~ 255&lt;/p&gt;

&lt;p&gt;SMALLINT(n) UNSIGNED&lt;/p&gt;

&lt;p&gt;Unsigned small integer, also called UINT2. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;2 bytes&lt;/p&gt;

&lt;p&gt;0 ~ +65,535&lt;/p&gt;

&lt;p&gt;INTEGER(n) UNSIGNED&lt;/p&gt;

&lt;p&gt;Unsigned integer, also called UINT4. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;4 bytes&lt;/p&gt;

&lt;p&gt;0 ~ +4,294,967,295&lt;/p&gt;

&lt;p&gt;MEDIUMINT(n) UNSIGNED&lt;/p&gt;

&lt;p&gt;Alias of UINT4. &lt;strong&gt;n&lt;/strong&gt; is meaningless and does not affect any performance.&lt;/p&gt;

&lt;p&gt;4 bytes&lt;/p&gt;

&lt;p&gt;0 ~ +4,294,967,295&lt;/p&gt;

&lt;p&gt;BIGINT(n) UNSIGNED&lt;/p&gt;

&lt;p&gt;Unsigned large integer, also called UINT8. &lt;strong&gt;n&lt;/strong&gt; has no actual meaning and does not affect any performance.&lt;/p&gt;

&lt;p&gt;8 bytes&lt;/p&gt;

&lt;p&gt;0 ~ +18,446,744,073,709,551,615&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table that contains data of the TINYINT(n), SMALLINT(n), MEDIUMINT(n), and BIGINT(n) types.&lt;br&gt;
openGauss=# CREATE TABLE int_type_t1&lt;br&gt;
           (&lt;br&gt;
            IT_COL1 TINYINT(10),&lt;br&gt;
            IT_COL2 SMALLINT(20),&lt;br&gt;
            IT_COL3 MEDIUMINT(30),&lt;br&gt;
            IT_COL4 BIGINT(40),&lt;br&gt;
            IT_COL5 INTEGER(50)&lt;br&gt;
           );&lt;/p&gt;

&lt;p&gt;--View the table structure.&lt;br&gt;
openGauss=# \d int_type_t1&lt;br&gt;
   Table "public.int_type_t1"&lt;br&gt;
 Column  |   Type   | Modifiers&lt;br&gt;
---------+----------+-----------&lt;br&gt;
 it_col1 | tinyint  |&lt;br&gt;
 it_col2 | smallint |&lt;br&gt;
 it_col3 | integer  |&lt;br&gt;
 it_col4 | bigint   |&lt;br&gt;
 it_col5 | integer  |&lt;/p&gt;

&lt;p&gt;--Create a table with the zerofill attribute column.&lt;br&gt;
openGauss=# CREATE TABLE int_type_t2&lt;br&gt;
           (&lt;br&gt;
            IT_COL1 TINYINT(10) zerofill,&lt;br&gt;
            IT_COL2 SMALLINT(20) unsigned zerofill,&lt;br&gt;
            IT_COL3 MEDIUMINT(30) unsigned,&lt;br&gt;
            IT_COL4 BIGINT(40) zerofill,&lt;br&gt;
            IT_COL5 INTEGER(50) zerofill&lt;br&gt;
           );&lt;/p&gt;

&lt;p&gt;--View the table structure.&lt;br&gt;
openGauss=# \d int_type_t2&lt;br&gt;
   Table "public.int_type_t2"&lt;br&gt;
 Column  | Type  | Modifiers&lt;br&gt;
---------+-------+-----------&lt;br&gt;
 it_col1 | uint1 |&lt;br&gt;
 it_col2 | uint2 |&lt;br&gt;
 it_col3 | uint4 |&lt;br&gt;
 it_col4 | uint8 |&lt;br&gt;
 it_col5 | uint4 |&lt;/p&gt;

&lt;p&gt;--Delete a table.&lt;br&gt;
openGauss=# DROP TABLE int_type_t1, int_type_t2;&lt;/p&gt;

&lt;p&gt;--Use CAST UNSIGNED to convert an expression to the uint8 type.&lt;br&gt;
openGauss=# select cast(1 - 2 as unsigned);&lt;/p&gt;

&lt;h2&gt;
  
  
          uint8
&lt;/h2&gt;

&lt;p&gt;18446744073709551615&lt;br&gt;
(1 row)&lt;/p&gt;

&lt;p&gt;--Use CAST SIGNED to convert an expression to the int8 type.&lt;br&gt;
openGauss=# select cast(1 - 2 as signed);&lt;/p&gt;

&lt;h2&gt;
  
  
   int8
&lt;/h2&gt;

&lt;p&gt;-1&lt;br&gt;
(1 row)&lt;br&gt;
Table 2 Arbitrary precision types&lt;/p&gt;

&lt;p&gt;Name&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;Storage Space&lt;/p&gt;

&lt;p&gt;Value Range&lt;/p&gt;

&lt;p&gt;NUMERIC[(p[,s])],&lt;/p&gt;

&lt;p&gt;DECIMAL[(p[,s])]&lt;/p&gt;

&lt;p&gt;FIXED[(p[,s])]&lt;/p&gt;

&lt;p&gt;The value range of p (precision) is [1,1000], and the value range of s (scale) is [0,p].&lt;/p&gt;

&lt;p&gt;Note:&lt;br&gt;
p indicates the total digits, and s indicates the decimal digits.&lt;/p&gt;

&lt;p&gt;The precision is specified by users. Two bytes are occupied for every four decimals of precision. An extra eight-byte overhead is added for numbers of this type.&lt;/p&gt;

&lt;p&gt;If the precision is not specified, the value is equivalent to (10,0), that is, a maximum of 10 digits before the decimal point and 0 digits after the decimal point.&lt;/p&gt;

&lt;p&gt;NUMBER[(p[,s])]&lt;/p&gt;

&lt;p&gt;Alias of the NUMERIC class.&lt;/p&gt;

&lt;p&gt;The precision is specified by users. Two bytes are occupied for every four decimals of precision. An extra eight-byte overhead is added for numbers of this type.&lt;/p&gt;

&lt;p&gt;Up to 131,072 digits before the decimal point and up to 16,383 digits after the decimal point when no precision is specified.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table with FIXED(p,s), FIXED, decimal, and number data.&lt;br&gt;
openGauss=# CREATE TABLE dec_type_t1&lt;br&gt;
           (&lt;br&gt;
            DEC_COL1 FIXED,&lt;br&gt;
            DEC_COL2 FIXED(20,5),&lt;br&gt;
            DEC_COL3 DECIMAL,&lt;br&gt;
            DEC_COL4 NUMBER&lt;br&gt;
           );&lt;/p&gt;

&lt;p&gt;--View the table structure.&lt;br&gt;
openGauss=# \d dec_type_t1&lt;br&gt;
      Table "public.dec_type_t1"&lt;br&gt;
  Column  |     Type      | Modifiers&lt;br&gt;
----------+---------------+-----------&lt;br&gt;
 dec_col1 | numeric(10,0) |&lt;br&gt;
 dec_col2 | numeric(20,5) |&lt;br&gt;
 dec_col3 | numeric(10,0) |&lt;br&gt;
 dec_col4 | numeric       |&lt;/p&gt;

&lt;p&gt;--Delete a table.&lt;br&gt;
openGauss=# DROP TABLE dec_type_t1;&lt;br&gt;
Table 3 Floating-point types&lt;/p&gt;

&lt;p&gt;Name&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;Storage Space&lt;/p&gt;

&lt;p&gt;Value Range&lt;/p&gt;

&lt;p&gt;FLOAT[(p)],&lt;/p&gt;

&lt;p&gt;FLOAT4[(p)]&lt;/p&gt;

&lt;p&gt;Floating point, which is not very precise. The value range of &lt;strong&gt;p&lt;/strong&gt; (precision) is [1,53].&lt;/p&gt;

&lt;p&gt;4 bytes or 8 bytes&lt;/p&gt;

&lt;p&gt;When the precision p is between [1,24], the option REAL is used as the internal identifier. When the precision p is between [25,53], the option DOUBLE PRECISION is used as the internal identifier. If no precision is specified, REAL is used as the internal identifier.&lt;/p&gt;

&lt;p&gt;DOUBLE PRECISION,&lt;/p&gt;

&lt;p&gt;FLOAT8,&lt;/p&gt;

&lt;p&gt;DOUBLE&lt;/p&gt;

&lt;p&gt;Double-precision floating point, which is not very precise.&lt;/p&gt;

&lt;p&gt;8 bytes&lt;/p&gt;

&lt;p&gt;–1.79E+308 to 1.79E+308, 15-bit decimal digits.&lt;/p&gt;

&lt;p&gt;FLOAT4(p,s)&lt;/p&gt;

&lt;p&gt;The value range of p (precision) is [1,1000], and the value range of s (scale) is [0,p].&lt;/p&gt;

&lt;p&gt;Note:&lt;br&gt;
p indicates the total digits, and s indicates the decimal digits. It is equivalent to dec(p,s).&lt;/p&gt;

&lt;p&gt;The precision is specified by users. Two bytes are occupied for every four decimals of precision. An extra eight-byte overhead is added for numbers of this type.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
--Create a table that contains data of the float4(p,s), double, float4(n), and float(n) types.&lt;br&gt;
openGauss=# CREATE TABLE float_type_t1&lt;br&gt;
           (&lt;br&gt;
            F_COL1 FLOAT4(10,4),&lt;br&gt;
            F_COL2 DOUBLE,&lt;br&gt;
            F_COL3 float4(10),&lt;br&gt;
            F_COL4 float4(30),&lt;br&gt;
            F_COL5 float(10),&lt;br&gt;
            F_COL6 float(30)&lt;br&gt;
           );&lt;/p&gt;

&lt;p&gt;--View the table structure.&lt;br&gt;
openGauss=# \d float_type_t1&lt;br&gt;
     Table "public.float_type_t1"&lt;br&gt;
 Column |       Type       | Modifiers&lt;br&gt;
--------+------------------+-----------&lt;br&gt;
 f_col1 | numeric(10,4)    |&lt;br&gt;
 f_col2 | double precision |&lt;br&gt;
 f_col3 | real             |&lt;br&gt;
 f_col4 | double precision |&lt;br&gt;
 f_col5 | real             |&lt;br&gt;
 f_col6 | double precision |&lt;/p&gt;

&lt;p&gt;--Delete a table.&lt;br&gt;
openGauss=# DROP TABLE float_type_t1;&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss dolphin-keywords.</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Sun, 23 Apr 2023 02:35:11 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-dolphin-keywords-1o4k</link>
      <guid>https://dev.to/tongxi99658318/opengauss-dolphin-keywords-1o4k</guid>
      <description>&lt;p&gt;The SQL contains reserved and non-reserved words. Standards require that reserved keywords not be used as other identifiers. Non-reserved keywords have special meanings only in a specific environment and can be used as identifiers in other environments.&lt;/p&gt;

&lt;p&gt;The naming rules for identifiers are as follows:&lt;/p&gt;

&lt;p&gt;An identifier name can only contain letters, underscores, digits (0-9), and dollar signs ($).&lt;/p&gt;

&lt;p&gt;An identifier name must start with a letter (a to z) or an underscore (_).&lt;/p&gt;

&lt;p&gt;NOTE:&lt;/p&gt;

&lt;p&gt;The naming rules are recommended but not mandatory.&lt;/p&gt;

&lt;p&gt;In special cases, double quotation marks (") can be used to avoid special character errors.&lt;/p&gt;

&lt;p&gt;Compared with the original openGauss, Dolphin modifies keywords as follows:&lt;/p&gt;

&lt;p&gt;MEDIUMINT is added as a non-reserved keyword.&lt;br&gt;
The keyword DATE can be used as a function.&lt;br&gt;
LAST_DAY is added as a reserved keyword to distinguish the original LAST_DAY function of openGauss from the LAST_DAY function of Dolphin at the syntax level.&lt;br&gt;
GET_FORMAT is added as a non-reserved keyword to identify the GET_FORMAT function in syntax.&lt;br&gt;
DAY_HOUR, DAY_MINUTE, DAY_SECOND, DAY_MICROSECOND, HOUR_MINUTE, HOUR_SECOND, HOUR_MICROSECOND, MINUTE_SECOND, MINUTE_MICROSECOND, and SECOND_MICROSECOND are added as non-reserved keywords for the EXTRACT function to identify the corresponding unit in syntax.&lt;br&gt;
Table 1 SQL keywords&lt;/p&gt;

&lt;p&gt;Keyword&lt;/p&gt;

&lt;p&gt;openGauss&lt;/p&gt;

&lt;p&gt;SQL:1999&lt;/p&gt;

&lt;p&gt;SQL-92&lt;/p&gt;

&lt;p&gt;FORMAT&lt;/p&gt;

&lt;p&gt;Non-reserved (excluding functions and types)&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;IF&lt;/p&gt;

&lt;p&gt;Non-reserved (excluding functions and types)&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;KEYS&lt;/p&gt;

&lt;p&gt;Non-reserved&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;MEDIUMINT&lt;/p&gt;

&lt;p&gt;Non-reserved (excluding functions and types)&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;SIGNED&lt;/p&gt;

&lt;p&gt;Non-reserved (excluding functions and types)&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;UNSIGNED&lt;/p&gt;

&lt;p&gt;Non-reserved (excluding functions and types)&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;ZEROFILL&lt;/p&gt;

&lt;p&gt;Non-reserved&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;-&lt;/p&gt;

&lt;p&gt;DATE    Non-reserved (excluding functions and types)    -   -&lt;br&gt;
LAST_DAY    Reserved    -   -&lt;br&gt;
GET_FORMAT  Non-reserved (excluding functions and types)    -   -&lt;br&gt;
DAY_HOUR    Non-reserved    -   -&lt;br&gt;
DAY_MINUTE  Non-reserved    -   -&lt;br&gt;
DAY_SECOND  Non-reserved    -   -&lt;br&gt;
DAY_MICROSECOND Non-reserved    -   -&lt;br&gt;
HOUR_MINUTE Non-reserved    -   -&lt;br&gt;
HOUR_SECOND Non-reserved    -   -&lt;br&gt;
HOUR_MICROSECOND    Non-reserved    -   -&lt;br&gt;
MINUTE_SECOND   Non-reserved    -   -&lt;br&gt;
MINUTE_MICROSECOND  Non-reserved    -   -&lt;br&gt;
SECOND_MICROSECOND  Non-reserved    -   -&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss Dolphin Restrictions</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Sun, 23 Apr 2023 02:32:53 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-dolphin-restrictions-1e9d</link>
      <guid>https://dev.to/tongxi99658318/opengauss-dolphin-restrictions-1e9d</guid>
      <description>&lt;p&gt;The lite edition is not supported.&lt;br&gt;
The Dolphin plug-in cannot be deleted.&lt;br&gt;
The Dolphin plug-in can be created only in the B-compatible database.&lt;br&gt;
The Dolphin plug-in needs to create data types and functions in schemas such as pg_catalog. Therefore, loading the Dolphin plug-in requires initial user permissions. openGauss automatically loads the Dolphin plug-in when the initial user or a user with the initial user permissions connects to B-compatible database for the first time. If a B-compatible database has never been connected by an initial user or a user with initial user permissions, it will not load the Dolphin plug-in.&lt;br&gt;
All added or modified syntaxes in Dolphin cannot be viewed by running \h on the gsql client, and cannot be automatically supplemented on the gsql client.&lt;br&gt;
The creation of the Dolphin plug-in deletes the functions and types with the same name required by the plug-in that exists in the database and the objects that previously depend on the plug-in.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss Dolphin Installation</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Sun, 23 Apr 2023 02:31:14 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-dolphin-installation-a5a</link>
      <guid>https://dev.to/tongxi99658318/opengauss-dolphin-installation-a5a</guid>
      <description>&lt;p&gt;The plug-in is automatically installed and loaded. You do not need to manually install and load the plug-in. To manually compile and load the plug-in, perform the following steps:&lt;/p&gt;

&lt;p&gt;Compilation and Installation&lt;br&gt;
Compile and install openGauss.&lt;/p&gt;

&lt;p&gt;Copy the Dolphin source code to the contrib directory of the openGauss source code.&lt;/p&gt;

&lt;p&gt;Go to the Dolphin directory and run make install.&lt;/p&gt;

&lt;p&gt;Create a B-compatible database and connect to B-compatible database as the initial user.&lt;/p&gt;

&lt;p&gt;OM Installation&lt;br&gt;
Install openGauss on the OM.&lt;/p&gt;

&lt;p&gt;Copy the files required by the plug-in.&lt;br&gt;
Path of dolphin.so: app/lib/postgresql/&lt;br&gt;
Path of dolphin.control and dolphin–1.0.sql: app/share/postgresql/extension&lt;/p&gt;

&lt;p&gt;Create a B-compatible database and connect to B-compatible database as the initial user.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss Dolphin Overview</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Sun, 23 Apr 2023 02:30:30 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-dolphin-overview-469</link>
      <guid>https://dev.to/tongxi99658318/opengauss-dolphin-overview-469</guid>
      <description>&lt;p&gt;openGauss provides Dolphin extensions (version: Dolphin-1.0.0). Dolphin extensions of openGauss are compatible with MySQL databases (dbcompatibility='B') in terms of keywords, data types, constants and macros, functions and operators, expressions, type conversion, DDL/DML/DCL syntax, stored procedures/user-defined functions, and system views.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss Configuring Client Access Authentication</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Wed, 19 Apr 2023 02:35:20 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-n1g</link>
      <guid>https://dev.to/tongxi99658318/opengauss-n1g</guid>
      <description>&lt;p&gt;Background&lt;br&gt;
If a host needs to connect to a database remotely, you need to add information about the host in configuration file of the database system and perform client access authentication. The configuration file (pg_hba.conf by default) is stored in the data directory of the database. HBA is short for host-based authentication.&lt;/p&gt;

&lt;p&gt;The system supports the following three authentication methods, which all require the pg_hba.conf file.&lt;/p&gt;

&lt;p&gt;Host-based authentication: A server checks the configuration file based on the IP address, username, and target database of the client to determine whether the user can be authenticated.&lt;br&gt;
Password authentication: A password can be an encrypted password for remote connection or a non-encrypted password for local connection.&lt;br&gt;
SSL encryption: The OpenSSL is used to provide a secure connection between the server and the client.&lt;br&gt;
In the pg_hba.conf file, each record occupies one row and specifies an authentication rule. An empty row or a row started with a number sign (#) is neglected.&lt;/p&gt;

&lt;p&gt;Each authentication rule consists of multiple columns separated by spaces and forward slashes (/), or spaces and tab characters. If a field is enclosed with quotation marks ("), it can contain spaces. One record cannot span different rows.&lt;/p&gt;

&lt;p&gt;Procedure&lt;br&gt;
Log in as the OS user omm to the primary node of the database.&lt;/p&gt;

&lt;p&gt;Configure the client authentication mode and enable the client to connect to the host as user jack. User omm cannot be used for remote connection.&lt;/p&gt;

&lt;p&gt;Assume you are to allow the client whose IP address is 10.10.0.30 to access the current host.&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
gs_guc set -N all -I all -h "host all jack 10.10.0.30/32 sha256"&lt;br&gt;
 NOTE:&lt;/p&gt;

&lt;p&gt;Before using user jack, connect to the database locally and run the following command in the database to create user jack:&lt;br&gt;
""&lt;br&gt;
CREATE USER jack PASSWORD 'Test@123';&lt;br&gt;&lt;br&gt;
-N all indicates all hosts in openGauss.&lt;br&gt;
-I all indicates all instances on the host.&lt;br&gt;
-h specifies statements that need to be added in the pg_hba.conf file.&lt;br&gt;
all indicates that a client can connect to any database.&lt;br&gt;
jack indicates the user that accesses the database.&lt;br&gt;
10.10.0.30/32 indicates that only the client whose IP address is 10.10.0.30 can connect to the host. The specified IP address must be different from those used in openGauss. 32 indicates that there are 32 bits whose value is 1 in the subnet mask. That is, the subnet mask is 255.255.255.255.&lt;br&gt;
sha256 indicates that the password of user jack is encrypted using the SHA-256 algorithm.&lt;br&gt;
This command adds a rule to the pg_hba.conf file corresponds to the primary node of the database. The rule is used to authenticate clients that access primary node.&lt;/p&gt;

&lt;p&gt;Each record in the pg_hba.conf file can be in one of the following four formats. For parameter description of the four formats, see Configuration File Reference.&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
local     DATABASE USER METHOD [OPTIONS]&lt;br&gt;
host      DATABASE USER ADDRESS METHOD [OPTIONS]&lt;br&gt;
hostssl   DATABASE USER ADDRESS METHOD [OPTIONS]&lt;br&gt;
hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]&lt;br&gt;
During authentication, the system checks records in the pg_hba.conf file in sequence for connection requests, so the record sequence is vital.&lt;/p&gt;

&lt;p&gt;NOTE:&lt;br&gt;
Configure records in the pg_hba.conf file from top to bottom based on communication and format requirements in the descending order of priorities. The IP addresses of the openGauss cluster and added hosts are of the highest priority and should be configured prior to those manually configured by users. If the IP addresses manually configured by users and those of added hosts are in the same network segment, delete the manually configured IP addresses before the scale-out and configure them after the scale-out.&lt;/p&gt;

&lt;p&gt;The suggestions on configuring authentication rules are as follows:&lt;/p&gt;

&lt;p&gt;Records placed at the front have strict connection parameters but weak authentication methods.&lt;br&gt;
Records placed at the end have weak connection parameters but strict authentication methods.&lt;br&gt;
 NOTE:&lt;/p&gt;

&lt;p&gt;If a user wants to connect to a specified database, the user must be authenticated by the rules in the pg_hba.conf file and have the CONNECT permission for the database. If you want to restrict a user from connecting to certain databases, you can grant or revoke the user's CONNECT permission, which is easier than setting rules in the pg_hba.conf file.&lt;br&gt;
The trust authentication mode is insecure for a connection between the openGauss and a client outside the cluster. In this case, set the authentication mode to sha256.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss Comparison – Disk vs. MOT</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Wed, 19 Apr 2023 02:31:01 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-comparison-disk-vs-mot-2mi0</link>
      <guid>https://dev.to/tongxi99658318/opengauss-comparison-disk-vs-mot-2mi0</guid>
      <description>&lt;p&gt;The following table briefly compares the various features of the openGauss disk-based storage engine and the MOT storage engine.&lt;/p&gt;

&lt;p&gt;Table 1 Comparison – Disk-based vs. MOT&lt;/p&gt;

&lt;p&gt;Feature&lt;/p&gt;

&lt;p&gt;openGauss&lt;/p&gt;

&lt;p&gt;Disk Store&lt;/p&gt;

&lt;p&gt;openGauss&lt;/p&gt;

&lt;p&gt;MOT Engine&lt;/p&gt;

&lt;p&gt;Intel x86 + Kunpeng ARM&lt;/p&gt;

&lt;p&gt;Yes&lt;/p&gt;

&lt;p&gt;Yes&lt;/p&gt;

&lt;p&gt;SQL and Feature-set Coverage&lt;/p&gt;

&lt;p&gt;100%&lt;/p&gt;

&lt;p&gt;98%&lt;/p&gt;

&lt;p&gt;Scale-up (Many-cores, NUMA)&lt;/p&gt;

&lt;p&gt;Low Efficiency&lt;/p&gt;

&lt;p&gt;High Efficiency&lt;/p&gt;

&lt;p&gt;Throughput&lt;/p&gt;

&lt;p&gt;High&lt;/p&gt;

&lt;p&gt;Extremely High&lt;/p&gt;

&lt;p&gt;Latency&lt;/p&gt;

&lt;p&gt;Low&lt;/p&gt;

&lt;p&gt;Extremely Low&lt;/p&gt;

&lt;p&gt;Distributed (Cluster Mode)&lt;/p&gt;

&lt;p&gt;Yes&lt;/p&gt;

&lt;p&gt;Yes&lt;/p&gt;

&lt;p&gt;Isolation Levels&lt;/p&gt;

&lt;p&gt;READ COMMITTED&lt;br&gt;
REPEATABLE READ&lt;br&gt;
READ COMMITTED&lt;br&gt;
REPEATABLE READ&lt;br&gt;
Concurrency Control&lt;/p&gt;

&lt;p&gt;Pessimistic + MVCC&lt;/p&gt;

&lt;p&gt;Optimistic + MVCC&lt;/p&gt;

&lt;p&gt;Data Capacity (Data + Index)&lt;/p&gt;

&lt;p&gt;Unlimited&lt;/p&gt;

&lt;p&gt;Limited to DRAM&lt;/p&gt;

&lt;p&gt;Native Compilation&lt;/p&gt;

&lt;p&gt;No&lt;/p&gt;

&lt;p&gt;Yes&lt;/p&gt;

&lt;p&gt;Query (by PREPARE command)&lt;br&gt;
Stored Procedures (by PREPARE command)&lt;br&gt;
Replication, Recovery&lt;/p&gt;

&lt;p&gt;Yes&lt;/p&gt;

&lt;p&gt;Yes&lt;/p&gt;

&lt;p&gt;Replication Options&lt;/p&gt;

&lt;p&gt;2 (sync, async)&lt;/p&gt;

&lt;p&gt;3 (sync, async, group-commit)&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss MOT JIT Diagnostics</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Wed, 19 Apr 2023 02:27:10 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-mot-jit-diagnostics-3830</link>
      <guid>https://dev.to/tongxi99658318/opengauss-mot-jit-diagnostics-3830</guid>
      <description>&lt;p&gt;mot_jit_detail&lt;br&gt;
This built-in function is used to query the details about JIT compilation (code generation).&lt;/p&gt;

&lt;p&gt;Usage Examples&lt;br&gt;
""&lt;br&gt;
select * from mot_jit_detail();&lt;/p&gt;

&lt;p&gt;select proc_oid, substr(query, 0, 50), namespace, jittable_status, valid_status, last_updated, plan_type, codegen_time from mot_jit_detail();&lt;br&gt;
Output Description&lt;br&gt;
Field&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;proc_oid&lt;/p&gt;

&lt;p&gt;Procedure OID (Real Object ID of the procedure in the database). 0 for queries.&lt;/p&gt;

&lt;p&gt;query&lt;/p&gt;

&lt;p&gt;Query string or stored procedure name.&lt;/p&gt;

&lt;p&gt;namespace&lt;/p&gt;

&lt;p&gt;Namespace to which the query or procedure belongs to. For procedures and top level queries, the value will be GLOBAL. For all the invoke queries, sub-queries, this field will show the parent information.&lt;/p&gt;

&lt;p&gt;jittable_status&lt;/p&gt;

&lt;p&gt;Whether the query or procedure is jittable:&lt;br&gt;
jittable – Query or procedure is jittable&lt;br&gt;
unjittable - Query or procedure is not jittable&lt;br&gt;
invalid - Invalid state (temporary state after invalidation due to DDL or when JIT compilation is in progress)&lt;br&gt;
valid_status&lt;/p&gt;

&lt;p&gt;Whether the query or procedure is valid or not:&lt;/p&gt;

&lt;p&gt;valid – Query or procedure is valid&lt;br&gt;
unavailable – JIT compilation is in progress&lt;br&gt;
error – Error state&lt;br&gt;
dropped – Procedure is dropped&lt;br&gt;
replaced – Procedure is replaced&lt;br&gt;
last_updated&lt;/p&gt;

&lt;p&gt;Timestamp when the status was updated last time.&lt;/p&gt;

&lt;p&gt;plan_type&lt;/p&gt;

&lt;p&gt;Whether this is a stored procedure (SP) or query type.&lt;/p&gt;

&lt;p&gt;codegen_time&lt;/p&gt;

&lt;p&gt;Total time taken for code generation (JIT compilation), in micro seconds.&lt;/p&gt;

&lt;p&gt;verify_time&lt;/p&gt;

&lt;p&gt;LLVM Verification time (internal), in micro seconds.&lt;/p&gt;

&lt;p&gt;finalize_time&lt;/p&gt;

&lt;p&gt;LLVM Finalize time (internal), in micro seconds.&lt;/p&gt;

&lt;p&gt;compile_time&lt;/p&gt;

&lt;p&gt;LLVM Compile time (internal), in micro seconds.&lt;/p&gt;

&lt;p&gt;mot_jit_profile&lt;br&gt;
This built-in function is used to query the profiling data (performance data) of the query or stored procedure execution.&lt;/p&gt;

&lt;p&gt;Usage Examples&lt;br&gt;
""&lt;br&gt;
select * from mot_jit_profile();&lt;/p&gt;

&lt;p&gt;select proc_oid, id, parent_id, substr(query, 0, 50), namespace, weight, total, self, child_gross, child_net from mot_jit_profile();&lt;br&gt;
Output Description&lt;br&gt;
Field&lt;/p&gt;

&lt;p&gt;Description&lt;/p&gt;

&lt;p&gt;proc_oid&lt;/p&gt;

&lt;p&gt;Procedure OID (Real Object ID of the procedure in the database). 0 for queries.&lt;/p&gt;

&lt;p&gt;id&lt;/p&gt;

&lt;p&gt;Internal ID to manipulate the output.&lt;/p&gt;

&lt;p&gt;parent_id&lt;/p&gt;

&lt;p&gt;Parent ID (Internal ID of the parent). Applicable only for sub-queries and sub-procedures. -1 for top-level queries and procedures.&lt;/p&gt;

&lt;p&gt;query&lt;/p&gt;

&lt;p&gt;Query string or stored procedure name.&lt;/p&gt;

&lt;p&gt;namespace&lt;/p&gt;

&lt;p&gt;Namespace to which the query or procedure belongs to. For procedures and top level queries, the value will be GLOBAL. For all the invoke queries, sub-queries, this field will show the parent information.&lt;/p&gt;

&lt;p&gt;weight&lt;/p&gt;

&lt;p&gt;The average number of times the sub-query or sub-procedure was executed (per one parent SP execution), in micro seconds.&lt;/p&gt;

&lt;p&gt;total&lt;/p&gt;

&lt;p&gt;Total time taken to execute the query or procedure, in micro seconds.&lt;/p&gt;

&lt;p&gt;self&lt;/p&gt;

&lt;p&gt;Time taken by the query or procedure excluding the time taken by the sub-queries &amp;amp; sub-procedures, in micro seconds.&lt;/p&gt;

&lt;p&gt;child_gross&lt;/p&gt;

&lt;p&gt;Total time spent in execution of all the sub-queries &amp;amp; sub-procedures (child_net + time spent to prepare for execution of all the sub-queries &amp;amp; sub-procedures), in micro seconds.&lt;/p&gt;

&lt;p&gt;child_net&lt;/p&gt;

&lt;p&gt;Total time taken by all the sub-queries &amp;amp; sub-procedures i.e., ∑ (total of child * weight), in micro seconds.&lt;/p&gt;

&lt;p&gt;def_vars&lt;/p&gt;

&lt;p&gt;Time taken to define variables (internal), in micro seconds.&lt;/p&gt;

&lt;p&gt;init_vars&lt;/p&gt;

&lt;p&gt;Time taken to initialize variables (internal), in micro seconds.&lt;/p&gt;

&lt;p&gt;Miscellaneous&lt;br&gt;
Another useful system table to get information about stored procedures and functions is pg_proc.&lt;/p&gt;

&lt;p&gt;For example, body of a stored procedure can be queried using the following query:&lt;/p&gt;

&lt;p&gt;""&lt;br&gt;
select proname,prosrc from pg_proc where proname='sp_call_filter_rules_100_1';&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
    <item>
      <title>openGauss JIT for Stored procedures</title>
      <dc:creator>tongxi</dc:creator>
      <pubDate>Wed, 19 Apr 2023 02:26:15 +0000</pubDate>
      <link>https://dev.to/tongxi99658318/opengauss-jit-for-stored-procedures-1n3i</link>
      <guid>https://dev.to/tongxi99658318/opengauss-jit-for-stored-procedures-1n3i</guid>
      <description>&lt;p&gt;JIT for Stored Procedures (JIT SP) is supported by the openGauss MOT engine (starting from 5.0 version), and its goal is deliver even higher performance and lower latency.&lt;/p&gt;

&lt;p&gt;JIT SP refers to code generation, compiling and execution of stored procedures (SP) by LLVM runtime code generation and execution library. JIT SP is available to SPs accessing MOT tables (only) and is completely transparent to users. SPs with Cross-Tx usage will be executed by standard PLSQL. Acceleration level depends on the SP logic complexity. For example, a real customer application achieved acceleration of 20%, 44%, 300% and 500% for different SPs, shaving microseconds to tens of milliseconds of the SP latency.&lt;/p&gt;

&lt;p&gt;During the PREPARE phase of a query invoking an SP, or the first SP execution, the JIT module performs an attempt to translate the SP SQL into a C-based function and compile it in runtime (using LLVM). If successful, the consecutive SP invocations the MOT will execute a compiled function, leading to performance gains. In case of failure to produce a compiled function, the SP will be executed by standard PLSQL. Both scenarios are fully transparent to users.&lt;/p&gt;

&lt;p&gt;You may refer to JIT Diagnostics for useful diagnostics information.&lt;/p&gt;

</description>
      <category>opengauss</category>
    </item>
  </channel>
</rss>
