Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open source column-oriented storage engine for PostgreSQL?

Tags:

Are there any open source projects in the works to create a column-oriented storage engine for PostgreSQL? I know Yahoo created one in-house, and that there are commercial products built on PostgreSQL that are column-oriented.

like image 651
Rob Avatar asked May 04 '09 16:05

Rob


People also ask

Does PostgreSQL support columnar storage?

Postgres is a full featured open source DB that has both traditional row based storage (sometimes called “heapfiles”) as well as a columnar store extension (cstore_fdw).

Is PostgreSQL column oriented?

As of 9.4, PostgreSQL is a row-oriented database server. The project and requirements described here have the objective of implementing performance improvements using column storage techniques.

What is the storage engine for PostgreSQL?

PostgreSQL has one storage engine; MySQL has nine, but only two of those really matter to most users: MyIsam and InnoDB. MyIsam was the original engine, built for speed, but it lacked transactions; InnoDB has transactions and is speedier than MyIsam, which is why it's the default storage engine.

Is PostgreSQL column store?

In row-oriented databases such as PostgreSQL, data pages (or blocks) store the values of an entire row together, sequentially for each column in the row.


3 Answers

Citus Data has developed an open source columnar store extension for PostgreSQL. It is available under the Apache License v2.0. It supports PostgreSQL 9.3 and higher.

First, creation the extension and a foreign server:

CREATE EXTENSION cstore_fdw;  CREATE SERVER cstore_server FOREIGN DATA WRAPPER cstore_fdw; 

Next, create some foreign tables:

CREATE FOREIGN TABLE customer_reviews (     customer_id TEXT,     review_date DATE,     review_rating INTEGER,     review_votes INTEGER,     review_helpful_votes INTEGER,     product_id CHAR(10),     product_title TEXT,     product_sales_rank BIGINT,     product_group TEXT,     product_category TEXT,     product_subcategory TEXT,     similar_product_ids CHAR(10)[] ) SERVER cstore_server OPTIONS(filename '/opt/citusdb/3.0/cstore/customer_reviews.cstore',         compression 'pglz'); 

Finally, COPY data into the table:

COPY customer_reviews FROM '/home/user/customer_reviews_1998.csv' WITH CSV; 

Foreign tables can be queried like any other table. You can even join them with regular tables.

More examples and information are available in a related blog post and the project's home page.

like image 62
Hadi Moshayedi Avatar answered Oct 17 '22 00:10

Hadi Moshayedi


The lack of responses here and my own research seems to indicate that there are indeed no open source initiatives to add column storage to PostgreSQL.

There was some talk in 2008 about Yahoo possibly outsourcing Everest (their column store back end for PostgreSQL), so here's hoping that they'll release it.

like image 44
Rob Avatar answered Oct 16 '22 23:10

Rob


Greenplum has created a column-oriented storage engine for PostgreSQL.

like image 23
nickb Avatar answered Oct 17 '22 00:10

nickb