Tuesday, 13 August 2013

PostgreSQL

The world’s most advanced open source database.
Version PostgreSQL
9.3,9.2,9.1,8.4 latest releases
"Open source and free PostgreSQL has the speed, compatibility, SQL, and features as sophisticated as the number one commercial database."
MySQL
PostgreSQL
InnoDB, NDB and MEMORY engines support Hash indexes
PostgreSQL supports Hash indexes, though as of 8.1 they are never faster than b-tree indexes
MySQL supports multiple indexes per table and can use one for each alias of a table; since 5.0 it will also use index merge to use multiple indexes for a single alias.
PostgreSQL supports multiple indexes per query.
MySQL comes with full-text search for InnoDB and MyISAM storage engines. Prior to version 5.6 only the MyISAM storage engine supported this feature.
A 3rd party add-on to MySQL,  allows it to support full-text searches on storage engines which do not natively support it
PostgreSQL 8.2 has full text search in the module.
PostgreSQL 8.3 integrates tsearch2 into the core: "TSearch2, our cutting-edge full text search tool, has been fully integrated into the core code, and also has a cleaner API." 

MySQL does not support partial indexes.
PostgreSQL supports partial indexes:
MySQL supports prefix indexes. Prefix indexes cover the first N characters of a string column, making the index much smaller than one that covers the entire width of the column, yet still provide good performance characteristics.
With PostgreSQL, prefix indexes are a particular case of Expression Indexes
MySQL is limited to 16 columns per index.  And not all storage engines provide multi-column indexes.
PostgreSQL is limited to 32 columns per index.
MySQL has no bitmap indexes but achieves similar functionality using its "index_merge" feature.
PostgreSQL supports the ability to combine multiple indexes at query time using bitmap indexes.
Expression Indexes can be emulated in MySQL by adding a precomputed column and using a trigger to maintain it
PostgreSQL allows you to create indexes based on expressions (which may include calls to immutable functions). This is very handy in case there is a table with relatively stable data (not a lot of inserts / updates) and will often be running a query which involves an expensive calculation - the expression itself can be indexed thus eliminating the need of computing it at query runtime.
MySQL supports covering indexes, which allow data to be selected by scanning the index alone without touching the table data. This is advantageous with large tables that have many millions of rows.
Covering indexes were added to PostgreSQL 9.2



No comments:

Post a Comment