converting from mysql to postgresql

17
PostgreSQL John Ashmead MySQL

Upload: john-ashmead

Post on 08-May-2015

1.445 views

Category:

Technology


0 download

DESCRIPTION

How to convert from MySQL to PostgreSQL: discuss history of each, current status, when you might wish to convert, what might motivate you to convert, & how to do so. With references.

TRANSCRIPT

Page 1: Converting from MySQL to PostgreSQL

PostgreSQL

John AshmeadMySQL

Page 2: Converting from MySQL to PostgreSQL

MySQL vs PostgreSQL• MySQL covered basics

• But a bit flaky in practice, under load

• Had looked at PostgreSQL before, but relooked

• Others have had similar problems

http://tapoueh.org/blog/2013/08/08-MySQL-to-PostgreSQL

Page 3: Converting from MySQL to PostgreSQL

• Clay tablets

• For taxes (but you knew that)

• The map replaces the territory

The First Database

Page 4: Converting from MySQL to PostgreSQL

Size matters!

• Ad hoc tools

• SQLite

• MySQL

• PostgreSQL

Page 5: Converting from MySQL to PostgreSQL

Popularity

http://db-engines.com/en/ranking

Page 6: Converting from MySQL to PostgreSQL

MySQL History• Named after Widenius’s daughter ‘My’!

• Version 5.0 with relational integrity, transactions, & stored procedures (i.e. real) in 2005

• Bought by Sun in 2008

• Eaten by Oracle in 2010

• Forks: MariaDB (by Widenius), Drizzle

Page 7: Converting from MySQL to PostgreSQL

PostgreSQL• Ingres

• Postgres a seQUEL to Ingres

• Postgres95 - released on web

• Open source version 1996

• Has caught up with MySQL on speed & reliability, still ahead on features

• MySQL is open source, PostgreSQL is open project

Page 8: Converting from MySQL to PostgreSQL

Decision Points

• New Project

• Organizational changes

• Accumulated stress

• Feature lust

• Strategic planning

Page 9: Converting from MySQL to PostgreSQL

Why• Features: i.e. PostGIS, FDW, Stored procedure

languages

• Performance

• Reliability

• Plays nice with others

• Others: culture, fear of Larry Ellison, kool-factor, …

Page 10: Converting from MySQL to PostgreSQL

MySQL Gotchas

• Nulls->default

• Case insensitivity

• Select 1/0 -> Null

• February 31st

http://sql-info.de/mysql/gotchas.html

Page 11: Converting from MySQL to PostgreSQL

Approachs• hack & go

• pivot with frameworks

• migration assistants

• plan & persevere (step at a time)

• halfway houses, i.e. with ODBC

Page 12: Converting from MySQL to PostgreSQL

Hack & go• Schema level

• Data

• Application level

• Configuration level

• Tools

• Documentation

• Culture

Page 13: Converting from MySQL to PostgreSQL

Pivot with a framework• SQL Alchemy on

Python

• Ruby on Rails/ActiveRecord on Ruby

• DBI on Perl

• Pear DB on PHP

Page 14: Converting from MySQL to PostgreSQL

Migration Assistants

Page 15: Converting from MySQL to PostgreSQL

Plan & persevere

• EnterpriseDB

• Internal task force

• Culture: desperate late night appeals for help often answered

Page 16: Converting from MySQL to PostgreSQL

Summary

• PostgreSQL makes sense for new projects

• For specific features

• As operational core

• Should be familiar with alternatives: relational, graph, noSQL, and so on.

Page 17: Converting from MySQL to PostgreSQL

Further information• http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL

• https://wiki.postgresql.org/wiki/How_to_make_a_proper_migration_from_MySQL_to_PostgreSQL

• http://www.enterprisedb.com/solutions/mysql-vs-postgresql

• http://www.slideshare.net/akmed13/converting-from-mysql-to-postgresql