This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 2320c014bd5 Update
Jan_28_Blog_PG_Create_a_Distributed_Database_Solution_Based_on_PostgreSQL_&_openGauss.en.md
(#31654)
2320c014bd5 is described below
commit 2320c014bd54ee5de278d584861e405239fe42a2
Author: LJ <[email protected]>
AuthorDate: Tue Jun 11 23:57:32 2024 +0800
Update
Jan_28_Blog_PG_Create_a_Distributed_Database_Solution_Based_on_PostgreSQL_&_openGauss.en.md
(#31654)
---
..._Solution_Based_on_PostgreSQL_&_openGauss.en.md | 39 ++++++++++++----------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git
a/docs/blog/content/material/Jan_28_Blog_PG_Create_a_Distributed_Database_Solution_Based_on_PostgreSQL_&_openGauss.en.md
b/docs/blog/content/material/Jan_28_Blog_PG_Create_a_Distributed_Database_Solution_Based_on_PostgreSQL_&_openGauss.en.md
index ea6be7c3ea6..b0618af5d06 100644
---
a/docs/blog/content/material/Jan_28_Blog_PG_Create_a_Distributed_Database_Solution_Based_on_PostgreSQL_&_openGauss.en.md
+++
b/docs/blog/content/material/Jan_28_Blog_PG_Create_a_Distributed_Database_Solution_Based_on_PostgreSQL_&_openGauss.en.md
@@ -24,9 +24,9 @@ ShardingSphere-Proxy is an adapter in the ShardingSphere
ecosystem and is positi
| | ShardingSphere-JDBC | ShardingSphere-Proxy |
-| :--- | :----: | ---: |
+| :--- | :----: | :---: |
| Database | Any | Databases based on MySQL / PostgreSQL protocol
|
-| Connected Consumption | High | Low |
+| Connected Consumption | High |Low |
| Heterogeneous Language | Support Java among other JVM-based languages
| Any |
| Performance | Low loss | Relatively high loss |
| Decentralization | Yes | No |
@@ -46,26 +46,28 @@ However, since ShardingSphere-Proxy has an extra layer of
network interaction co

Simple Query and Extended Query are the most common protocols for most users
using PostgreSQL. For instance, when using the following command line tool
`psql` to connect PostgreSQL for CRUD operation, the Simple Query is often used
to interact with the database.
-
-`$ psql -h 127.0.0.1 -U postgres
+```
+$ psql -h 127.0.0.1 -U postgres
psql (14.0 (Debian 14.0-1.pgdg110+1))
Type "help" for help.
postgres=# select id, name from person where age < 35;
id | name
----+------
1 | Foo
-(1 row)`
+(1 row)
+```
The protocol interaction diagram of Simple Query is as follows:

When using PostgreSQL JDBC Driver and other drivers, code is as follows
PreparedStatement, which corresponds to the Extended Query protocol in default.
-
-`String sql = "select id, name from person where age > ?";
+```
+String sql = "select id, name from person where age > ?";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setInt(1, 35);
-ResultSet resultSet = ps.executeQuery();`
+ResultSet resultSet = ps.executeQuery();
+```
The protocol interaction diagram of Extended Query is as follows:
@@ -85,11 +87,12 @@ openGauss database has a corresponding JDBC Driver. The
prefix of JDBC URL is `j
For example, when we prepare an insert sentence such as the following:
-`insert into person (id, name, age) values (?, ?, ?)`
+```insert into person (id, name, age) values (?, ?, ?)```
Taking JDBC for example, we could use the following method to carry out batch
insertion:
-`String sql = "insert into person (id, name, age) values (?, ?, ?)";
+```
+String sql = "insert into person (id, name, age) values (?, ?, ?)";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setLong(1, 1);
ps.setString(2, "Foo");
@@ -103,7 +106,8 @@ ps.setLong(1, 3);
ps.setString(2, "Tom");
ps.setInt(3, 54);
ps.addBatch();
-ps.executeBatch();`
+ps.executeBatch();
+```
At the PostgreSQL protocol layer, `Bind` can transfer one set of parameters to
form Portal, and `Execute` can conduct one Portal each time.
@@ -117,9 +121,9 @@ Batch insertion could be realized through the repetition of
`Bind` and `Execute`
ShardingSphere-Proxy openGauss supports Batch Bind protocol, meaning that
**users could use the openGauss client end or driver to perform batch insertion
of the ShardingSphere Proxy.**
-##Future ShardingSphere-Proxy Developments
+## Future ShardingSphere-Proxy Developments
-###Support ShardingSphere PostgreSQL Proxy Logic Query in MetaData
+### Support ShardingSphere PostgreSQL Proxy Logic Query in MetaData
ShardingSphere-Proxy is a transparent database proxy, which means that users
do not need to think about how Proxy coordinates the databases.
@@ -133,7 +137,7 @@ When using `psql` to connect `PostgreSQL`, users could
query databases and table
However, different from MySQL, `show tables` is a language supported by MySQL,
while `\d` used in `psql` actually corresponds to a more complicated SQL.
Currently, when using ShardingSphere PostgreSQL Proxy, logic databases or logic
tables cannot be queried.
-###Describe Prepared Statement Supporting Extended Query
+### Describe Prepared Statement Supporting Extended Query
There are two types of Describe message in PostgreSQL protocol, which are
Describe Portal and Describe Prepared Statement. Currently, the ShardingSphere
Proxy only supports Describe Portal.
@@ -141,9 +145,10 @@ An example of the practical application of Describe
Prepared Statement:
Get the MetaData of the result set before executing PreparedStatement.
-`PreparedStatement preparedStatement = connection.prepareStatement("select *
from t_order limit ?");
-ResultSetMetaData metaData = preparedStatement.getMetaData();`
-
+```
+PreparedStatement preparedStatement = connection.prepareStatement("select *
from t_order limit ?");
+ResultSetMetaData metaData = preparedStatement.getMetaData();
+```
The ecosystem integration of ShardingSphere and PostgreSQL and openGauss is
still underway, with some steps left before full completion. If you are
interested in what we are doing, you’re welcome to join the ShardingSphere
community on GitHub, Twitter, Slack or through the official mailing list.