PostgreSQL Architecture

Friday 9 August 2013
PostgreSQL Architecture

Hello all,

Today I decided to write a blog on PostgreSQL architecture.
Off course, PostgreSQL has not defined its architecture in any of its Official documents. But this is a depiction / attempt from the way PostgreSQL internally works.
So this cannot be 100% right and All the valid corrections are truly welcome.

Lets start with the Architecture


Please note - The above diagram is courtesy of  http://raghavt.blogspot.in/2011/04/postgresql-90-architecture.html and I have learned a lot from his blogs.
The flow of processes can be seen in the Diagram above.
Lets understand each process, as to what they do.



Client Server (psql)

►Comprised of two main parts: the client application and the client interface library.

►Postgres comes prepackaged with its command line interface called psql

►Many different client applications, many of which run on different OS's, some include: Mergeant, PGInhaler, SQirreL and more.

►Client interface library is the way that each of those applications can talk to the Postgres Server because the client interface library will convert to the proper SQL queries that the server can understand and parse.

►This maximizes cohesion by the Postgres server not having to parse different languages, but only understand SQL queries, which makes the whole system faster.



Postmaster

►Is a daemon thread that runs constantly.

►Uses an implicit invocation architecture to listen for any and all calls to the database.

►When it receives a call from a client(psql or any other), it creates a back-end process (Postgres server) to match it, using 1-1 correspondence.

►Once the process is created, it links the postgres client and postgres process so that they no longer have to communicate through the Postmaster.



Postgres Back-end server process

►is responsible for executing the queries by the client.

►can handle only a single query at a time.

►to execute in parallel, an application must maintain multiple
connections to the server.

►back-end server can be executing concurrently.

►access DB data through the main-memory buffer pool as a shared
memory to have same view of data.

There are more utility process which still need to be explained,but for those processes you need to visit Raghav's link http://raghavt.blogspot.in/2011/04/postgresql-90-memory-processes.html
He has written the blog on memory and processes beautifully and is a must read for everybody, who is planning to understand internals of PostgreSQL.

Hope you all find this post useful and informative.

Read more ...

PostgreSQL 9.3 BETA 2 out with power packed features

Wednesday 24 July 2013
PostgreSQL 9.3 BETA 2 out with power packed features


Hello all it’s the annual release time for PostgreSQL Database community.
From the last few years, I have been following PostgreSQL community and they never disappoint me. And here they are with the promising power packed features embedded into the popular Open Source Database in the World. Yes, Its about the PostgreSQL and surely these features make it the MOST ADVANCED OPEN SOURCE DATABASE in the world.
I have become a big FAN of this Database, Firstly because its Open Source, Secondly because it  never falls behind the Commercial database in terms of features and also many few know this, Today’s Most advanced commercial database( Greenplum, Vertica ,…) come from the PostgreSQL database as the base.

So now moving to Latest Release of PostgreSQL
The latest release in still in the Beta phase and the beta phase has been launched on June 27th .
This is PostgreSQL 9.3 Beta 2 version and can be downloaded from http://www.postgresql.org/
This time around we can see feature in all aspects of PostgreSQL database

       New Features
  1.  Configuration directive 'include_dir'
  2. COPY FREEZE for more efficient bulk loading
  3. Custom Background Workers
  4.  JSON: Additional functionality
  5. LATERAL JOIN
  6.  Parallel pg_dump for faster backups
  7. 'pg_isready' server monitoring tool
  8.  Switch to Posix shared memory and mmap()
  9.  
  1.  Event Triggers
  1. Materialized Views
  2. Recursive View Syntax
  3. Updatable Views

  1. postgres_fdw
  1.  Streaming-Only Remastering
  2.  Fast Failover
  3. Architecture-Independent Streaming
  4. pg_basebackup conf setup
  1. CREATE TABLE output
  2. Server settings
  3.  WAL filenames may end in FF
With all these changes surely PostgreSQL is eyeing a good place in Database and Datawarehouse Industry. I will go through many of these in my upcoming blogs…. So stay tuned for interesting blogs ahead



Read more ...

PostgreSQL History

Tuesday 23 July 2013
Hello All,

This is my first blog with postgresql-database.blogspot.in

What better to start with History of PostgreSQL.


The PostgreSQL originates from University of California at Berkely, Computer Science Department. PostgreSQL is an open-source descendant of this original Berkeley code. Sometime People refer PostgreSQL as Postgres, or some time Postgre too! But I believe it doesn’t make any change as long as the meaning of these words are same and they all mean PostgreSQL database
Many few know, The father of many databases in today’s world and his name is Dr. Michael Stonebraker. The POSTGRES project was led by Dr. Michael Stonebraker and was sponsored by was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc.
The implementation of POSTGRES began in 1986. POSTGRES has undergone several major releases since then. The first "demoware" system became operational in 1987 and was shown at the 1988 ACM-SIGMOD Conference. The size of the external user community nearly doubled during 1993. It became increasingly obvious that maintenance of the prototype code and support was taking up large amounts of time that should have been devoted to database research. In an effort to reduce this support burden, the Berkeley POSTGRES project officially ended with Version 4.2.
Stonebraker and his graduate students actively developed Postgres for eight years. During that time, Postgres introduced rules, procedures, time travel, extensible types with indices and object-relational concepts. Postgres was later commercialized to become Illustra which was later bought by Informix and integrated into its Universal Server. Informix was purchased by IBM in 2001 for one billion dollars.

Postgres 95
In 1994, Andrew Yu and Jolly Chen added an SQL language interpreter to POSTGRES. Under a new name, Postgres95 was subsequently released to the web to find its own way in the world as an open-source descendant of the original POSTGRES Berkeley code. You will be amazed to know, Andrew Yu and Jolly Chen were Ph.D student from Stonebraker’s Lab
Postgres95 code was completely ANSI C and trimmed in size by 25%. Many internal changes improved performance and maintainability. Postgres95 release 1.0.x ran about 30-50% faster on the Wisconsin Benchmark compared to POSTGRES, Version 4.2.
In 1996, Postgres95 departed from academia and started a new life in the open source world when a group of dedicated developers outside of Berkeley saw the promise of the system, and devoted themselves to its continued development. Contributing enormous amounts of time, skill, labor, and technical expertise, this global development group radically transformed Postgres. Over the next eight years, they brought consistency and uniformity to the code base, created detailed regression tests for quality assurance, set up mailing lists for bug reports, fixed innumerable bugs, added incredible new features, and rounded out the system by filling various gaps such as documentation for developers and users. It was during this phase  that query language SQL was implemented, psql interactive program was implemented and many good implementations.

PostgreSQL

By 1996, it became clear that the name "Postgres95" would not stand the test of time. They chose a new name, PostgreSQL, to reflect the relationship between the original POSTGRES and the more recent versions with SQL capability. At the same time, they set the version numbering to start at 6.0, putting the numbers back into the sequence originally begun by the Berkeley POSTGRES project.
Every year PostgreSQL community has two releases one in the month of May and the other around the month of September. The PostgreSQL developer community is the world’s largest community in building an open source project. With this strength, I believe PostgreSQL in future has no boundaries for success
And here they are today with Version 9.3 Beta released to the World audience.

I hope this post was interesting and will cultivate your interest in this database.
Thank you

Read more ...