<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Development of a Parallel DBMS on the Basis of PostgreSQL</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>c Constantin Pan</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>M.Sc. advisor: Mikhail Zymbler</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Proceedings of the Spring Researcher's Colloquium on Database and Information Systems</institution>
          ,
          <addr-line>Moscow, Russia, 2011</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>South Ural State University</institution>
        </aff>
      </contrib-group>
      <fpage>2</fpage>
      <lpage>6</lpage>
      <abstract>
        <p>The paper describes the architecture and the design of PargreSQL parallel database management system (DBMS) for distributed memory multiprocessors. PargreSQL is based upon PostgreSQL open-source DBMS and exploits partitioned parallelism.</p>
      </abstract>
      <kwd-group>
        <kwd>Daemon</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Currently open-source PostgreSQL DBMS [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] is a
reliable alternative for commercial DBMSes. There are
many both practical database applications based upon
PostgreSQL and research projects devoted to extension
and improvement of PostgreSQL.
      </p>
      <p>One of the directions mentioned above is to adapt
PostgreSQL for parallel query processing. In this paper
we describe the architecture and design of PargreSQL
parallel DBMS for analytical data processing on
distributed multiprocessors. PargreSQL represents
PostgreSQL with embedded partitioned parallelism.</p>
      <p>The paper is organized as follows. Section 2 briefly
discusses related work. Section 3 gives a description of
the PostgreSQL DBMS architecture. Section 4
introduces design principles and architecture of PargreSQL
DBMS. The results of experiments on the current partial
implementation are shown in section 5. Section 6
contains concluding remarks and directions for future work.</p>
    </sec>
    <sec id="sec-2">
      <title>Related work</title>
      <p>The research on extension and improvement of
PostgreSQL DBMS includes the following.</p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] native XML type support in PostgreSQL is
discussed. Adding data types to provide support of HL7
medical information exchange standard in PostgreSQL
is described in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. The authors of [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] propose an
imagehandling extension to PostgreSQL. In [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] an approach
to integration of PostgreSQL with the Semantic Web is
presented.
      </p>
      <p>
        There are papers investigating adoption of
PostgreSQL for parallel query processing as well. In [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
authors introduce their work on extending PostgreSQL
      </p>
      <p>
        This paper is supported by the Russian Foundation for Basic
Research (grant No. 09-07-00241-a).
to support distributed query processing. Several
limitations in PostgreSQL’s query engine and corresponding
query execution techniques to improve performance of
distributed query processing are presented. ParGRES [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]
is an open-source database cluster middleware for high
performance OLAP query processing. ParGRES exploits
intra-query parallelism on PC clusters and uses adaptive
virtual partitioning of the database. GParGRES [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
exploits database replication and inter- and intra-query
parallelism to efficiently support OLAP queries in a grid.
The approach has two levels of query splitting:
gridlevel splitting, implemented by GParGRES, and
nodelevel splitting, implemented by ParGRES.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] building a hybrid between MapReduce and
parallel database is explored. The authors created a
prototype named HadoopDB on the basis of Hadoop and
PostgreSQL, that is as efficient as parallel DBMS, but as
scalable, fault tolerant and flexible as MapReduce systems.
PostgreSQL is used as the database layer and Hadoop as
the communication layer.
      </p>
      <p>
        Our contribution is embedding partitioned
parallelism [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] into PostgreSQL. We use methods for parallel
query processing, proposed in [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] and [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>PostgreSQL Architecture</title>
      <p>PostgreSQL is based on the client-server model. A
session involves three processes into interaction: a frontend,
a backend and a daemon (see fig. 1).</p>
      <p>connects 1</p>
      <p>1
-executor
1</p>
      <p>The daemon handles incoming connections from
frontends and creates a backend for each one. Each
backend executes queries received from the related frontend.
The activity diagram of a PostgreSQL session is shown
in fig. 2.</p>
      <p>There are following steps of query processing in
PostgreSQL: parse, rewrite, plan/optimize, and execute.</p>
      <p>Respective PostgreSQL subsystems are depicted in
fig. 3. Parser checks the syntax of the query string and
builds a parse tree. Rewriter processes the tree according
accept
fork
connect
send query
recv result
[more
queries] else
exec query
send result</p>
      <p>libpq
to the rules specified by the user (e.g. view definitions).
Planner creates an optimal execution plan for this query
tree. Executor takes the execution plan and processes it
recursively from the root. Storage provides functions to
store and retrieve tuples and metadata.
libpq implements frontend-backend interaction
protocol and consists of two parts: the frontend (libpq-fe) and
the backend (libpq-be). The former is deployed on the
client side and serves as an API for the end-user
application. The latter is deployed on the server side and serves
as an API for libpq-fe, as shown in fig. 4.
4</p>
    </sec>
    <sec id="sec-4">
      <title>PargreSQL Architecture</title>
      <p>
        PargreSQL utilizes the idea of partitioned parallelism [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]
as shown in fig. 5. This form of parallelism supposes
partitioning relations among the disks of the multiprocessor
system.
      </p>
      <p>The way the partitioning is done is defined by a
fragmentation function, which for each tuple of the relation
S0
P9
S9
⋮
g
n
i
g
re ⋮
M
Partitioning function
calculates the number of the processor node which this
tuple should be placed at. A query is executed in parallel
on all processor nodes as a set of parallel agents. Each
agent processes its own fragment and generates a partial
query result. The partial results are merged into the
resulting relation.</p>
      <p>The architecture of PargreSQL, in contrast with
PostgreSQL, assumes that a client connects to two or more
servers (see fig. 6).</p>
      <p>connects n
k
par_Frontend</p>
      <p>The interaction sequence is shown in fig. 7. As
opposed to PostgreSQL there are many daemons running in
PargreSQL. A frontend connects to each of them, sends
the same query to many backends, and receives the result
relation.</p>
      <p>2.1: create()
d1 : Daemon</p>
      <p>b1 : par_Backend
3.1: sendquery()
5.1: sendresult() 4.n: exchange()
1.1: connect()
1.n: connect()
f : par_Frontend
3.n: sendquery()
2.n: create()
dn : Daemon
bn : par_Backend
5.n: sendresult() 4.1: exchange()</p>
      <p>Parallel query processing in PargreSQL is done in
more steps: parse, rewrite, plan/optimize, parallelize,
execute, and balance. During the query execution each
agent processes its own part of the relation independently
so, to obtain the correct result, transfers of tuples are
required. Parallelization stages creation of a parallel plan
by inserting special exchange operators into the
corresponding places of the plan. Balance provides
loadbalancing of the server nodes.</p>
      <p>PargreSQL subsystems are depicted in fig. 8.
PostgreSQL is one of them. PargreSQL development
involves changes in Storage, Executor and Planner
subsystems of PostgreSQL.</p>
      <p>The changes in the old code are needed to integrate it
with the new subsystems. par Storage is responsible for
storing partitioning metadata of relations. par Exchange
encapsulates the exchange operator implementation.
Exchange operator is meant to compute the distribution
function for each tuple of the relation, send “alien”
tuples to the other nodes, and receive “own” tuples in
response.</p>
      <p>There are however some new subsystems which do
not require any changes in the old code: par libpq-fe and
par Compat. par libpq-fe is a wrapper around libpq-fe,
it is needed to propagate queries from an application to
many servers. par Compat makes this propagation
transparent to the application.
app</p>
      <p>MPS subsystem (Message Passing System) is used by
Scatter and Gather to transmit tuples. Its interface is like
MPI reduced to three methods: ISend, IRecv, and Test.
They are actually implemented on top of MPI.</p>
      <p>
        Figs. 14, 15, 16, and 17 show algorithms for next()
method of four exchange subnodes.
Exchange operator [
        <xref ref-type="bibr" rid="ref11 ref7">7, 11</xref>
        ] serves to exchange tuples
between parallel agents. It is inserted into execution plans
by Parallelizer subsystem. The operator’s architecture is
presented in fig. 12.
      </p>
      <p>Split is meant to calculate fragmentation function for
each tuple and choose whether to keep it on the processor
node or send it to other processor node.</p>
      <p>even := not even
[even]</p>
      <p>[odd]
right.next
left.next
tuple
left.next
right.next
tuple</p>
    </sec>
    <sec id="sec-5">
      <title>Experimental Evaluation</title>
      <p>At the moment we have implemented par libpq and
par Exchange subsystems of PargreSQL. The
implementation has been tested on the following query:
select * from tab where tab.col % 10000 = 0</p>
      <p>The query has been run against table tab consisting of
108 tuples. The speedup relative to PostgreSQL is shown
in fig. 18.</p>
      <p>6
5
p4
u
d
e
e
3
p
S
2
1</p>
      <p>Linear</p>
      <p>Actual
2
3
4
5</p>
      <p>6</p>
      <p>Nodes</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>Azza</given-names>
            <surname>Abouzeid</surname>
          </string-name>
          , Kamil Bajda-Pawlikowski, Daniel J. Abadi, Alexander Rasin, and Avi Silberschatz.
          <article-title>HadoopDB: An Architectural Hybrid of MapReduce and DBMS Technologies for Analytical Workloads</article-title>
          .
          <source>PVLDB</source>
          ,
          <volume>2</volume>
          (
          <issue>1</issue>
          ):
          <fpage>922</fpage>
          -
          <lpage>933</lpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>David J. DeWitt</surname>
          </string-name>
          and
          <string-name>
            <given-names>Jim</given-names>
            <surname>Gray</surname>
          </string-name>
          .
          <source>Parallel Database Systems: The Future of High Performance Database Systems. Commun. ACM</source>
          ,
          <volume>35</volume>
          (
          <issue>6</issue>
          ):
          <fpage>85</fpage>
          -
          <lpage>98</lpage>
          ,
          <year>1992</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Denise</given-names>
            <surname>Guliato</surname>
          </string-name>
          , Ernani V. de Melo,
          <string-name>
            <surname>Rangaraj M. Rangayyan</surname>
          </string-name>
          , and
          <string-name>
            <surname>Robson</surname>
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Soares.</surname>
          </string-name>
          POSTGRESQL-IE:
          <article-title>An Image-handling Extension for PostgreSQL</article-title>
          .
          <source>J. Digital Imaging</source>
          ,
          <volume>22</volume>
          (
          <issue>2</issue>
          ):
          <fpage>149</fpage>
          -
          <lpage>165</lpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Yeb</given-names>
            <surname>Havinga</surname>
          </string-name>
          , Willem Dijkstra, and Ander de Keijzer.
          <article-title>Adding HL7 version 3 data types to PostgreSQL</article-title>
          . CoRR, abs/1003.3370,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Nelson</given-names>
            <surname>Kotowski</surname>
          </string-name>
          ,
          <string-name>
            <surname>Alexandre A. B. Lima</surname>
            , Esther Pacitti, Patrick Valduriez, and
            <given-names>Marta</given-names>
          </string-name>
          <string-name>
            <surname>Mattoso</surname>
          </string-name>
          .
          <article-title>Parallel query processing for OLAP in grids</article-title>
          .
          <source>Concurrency and Computation: Practice and Experience</source>
          ,
          <volume>20</volume>
          (
          <issue>17</issue>
          ):
          <fpage>2039</fpage>
          -
          <lpage>2048</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Rubao</given-names>
            <surname>Lee</surname>
          </string-name>
          and
          <string-name>
            <given-names>Minghong</given-names>
            <surname>Zhou</surname>
          </string-name>
          .
          <article-title>Extending PostgreSQL to Support Distributed/Heterogeneous Query Processing</article-title>
          . In Kotagiri Ramamohanarao,
          <string-name>
            <given-names>P.</given-names>
            <surname>Radha</surname>
          </string-name>
          <string-name>
            <given-names>Krishna</given-names>
            ,
            <surname>Mukesh K. Mohania</surname>
          </string-name>
          , and Ekawit Nantajeewarawat, editors,
          <source>DASFAA</source>
          , volume
          <volume>4443</volume>
          of Lecture Notes in Computer Science, pages
          <fpage>1086</fpage>
          -
          <lpage>1097</lpage>
          . Springer,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Andrey</surname>
            <given-names>V.</given-names>
          </string-name>
          <string-name>
            <surname>Lepikhov</surname>
            and
            <given-names>Leonid B.</given-names>
          </string-name>
          <string-name>
            <surname>Sokolinsky</surname>
          </string-name>
          .
          <article-title>Query processing in a DBMS for cluster systems</article-title>
          .
          <source>Programming and Computer Software</source>
          ,
          <volume>36</volume>
          (
          <issue>4</issue>
          ):
          <fpage>205</fpage>
          -
          <lpage>215</lpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Dmitry</surname>
            <given-names>V.</given-names>
          </string-name>
          <string-name>
            <surname>Levshin</surname>
            and
            <given-names>A. S.</given-names>
          </string-name>
          <string-name>
            <surname>Markov</surname>
          </string-name>
          .
          <article-title>Algorithms for integrating PostgreSQL with the semantic web</article-title>
          .
          <source>Programming and Computer Software</source>
          ,
          <volume>35</volume>
          (
          <issue>3</issue>
          ):
          <fpage>136</fpage>
          -
          <lpage>144</lpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Melissa</given-names>
            <surname>Paes</surname>
          </string-name>
          ,
          <string-name>
            <surname>Alexandre A. B. Lima</surname>
            , Patrick Valduriez, and
            <given-names>Marta</given-names>
          </string-name>
          <string-name>
            <surname>Mattoso</surname>
          </string-name>
          .
          <article-title>High-Performance Query Processing of a Real-World OLAP Database with ParGRES</article-title>
          . In Jose´ M.
          <string-name>
            <surname>Laginha M. Palma</surname>
            , Patrick Amestoy,
            <given-names>Michel J</given-names>
          </string-name>
          . Dayde´,
          <string-name>
            <given-names>Marta</given-names>
            <surname>Mattoso</surname>
          </string-name>
          , and Joa˜o Correia Lopes, editors,
          <source>VECPAR</source>
          , volume
          <volume>5336</volume>
          of Lecture Notes in Computer Science, pages
          <fpage>188</fpage>
          -
          <lpage>200</lpage>
          . Springer,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>Nikolay</given-names>
            <surname>Samokhvalov</surname>
          </string-name>
          .
          <article-title>XML Support in PostgreSQL</article-title>
          . In Sergei D. Kuznetsov, Andrey Fomichev, Boris Novikov, and Dmitry Shaporenkov, editors,
          <source>SYRCoDIS</source>
          , volume
          <volume>256</volume>
          <source>of CEUR Workshop Proceedings. CEUR-WS.org</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Leonid</surname>
            <given-names>B.</given-names>
          </string-name>
          <string-name>
            <surname>Sokolinsky</surname>
          </string-name>
          .
          <article-title>Organization of Parallel Query Processing in Multiprocessor Database Machines with Hierarchical Architecture</article-title>
          .
          <source>Programming and Computer Software</source>
          ,
          <volume>27</volume>
          (
          <issue>6</issue>
          ):
          <fpage>297</fpage>
          -
          <lpage>308</lpage>
          ,
          <year>2001</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>Michael</given-names>
            <surname>Stonebraker</surname>
          </string-name>
          and
          <string-name>
            <given-names>Greg</given-names>
            <surname>Kemnitz</surname>
          </string-name>
          .
          <article-title>The POSTGRES next generation database management system</article-title>
          .
          <source>Commun. ACM</source>
          ,
          <volume>34</volume>
          :
          <fpage>78</fpage>
          -
          <lpage>92</lpage>
          ,
          <year>October 1991</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>