From:       To:      

Home > Documentation > MySQL to PostgreSQL

MySQL vs PostgreSQL

[MySQL to PostgreSQL Converter]  [About Migration]  [Types] [Views

Database

Both MySQL and PostgreSQL define the term "database". However, MySQL queries can access tables from different databases while user has access to each database. PostgreSQL does not allow to use multiple databases in the same query when not using Foreign Data Wrappers. On the other hand, PostgreSQL can operate with multiple "schemas" inside the single database that makes it pretty close to MySQL databases.

Command Line

Here is a list of common MySQL and PostgreSQL commands that allows to query some useful data:

MySQL PostgreSQL Description
USE `database_name` \c "database_name" connect to database
SHOW DATABASES \l list all available databases
SHOW TABLES \dt list all tables in the current database
DESC `table_name` \d "table_name" describe a table
SHOW FULL TABLES IN `database_name` WHERE TABLE_TYPE LIKE 'VIEW' \dv list available views in the current database
QUIT \q quit the command line processor

Cluster

When talking about MySQL, "cluster" means multiple database servers connected together and working like a single host for end users. PostgreSQL "cluster" is a single running instance of database server that contains one or more databases.

Types

The following table shows the mapping between MySQL data types and PostgreSQL data types: MySQL - PostgreSQL Type Mapping.

Views

Basic differences between syntax of MySQL and PostgreSQL SELECT-queries are listed in this article.