The invention discloses a method for executing
sql (structured
query language) in parallel in a green
database. The method provided by the invention comprises the following steps: step 1, installing plpython extension for the green plums; 1-1, when the installation is started from the greenplum7, plpython is carried by the greenplum7, and a
source code needs to be downloaded by the greenplum7 to be compiled and installed by the greenplum7; and 1-2, after installation, expansion of python3 is created through create extension plpython3u, so that a storage process of gp can be written through python subsequently and conveniently. And step 2, writing a common function, and realizing parallel calling of multiple
sql statements. 2-1, defining a common function; 2-2, acquiring
database connection information; 2-3, setting the
database to be free from the own IP
password; 2-4, assembling a psql command execution function; and 2-5, starting the
thread pool to execute parallel execution. According to the method, a
database administrator only needs to create an exesqls common function at one time, other developers can realize multi-
sql parallel execution which cannot be supported by the database through simple sql statements, and other languages such as python are not needed.