32
LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007 LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007 Software Libero e RDBMS Software Libero e RDBMS Alessandro Benati Alessandro Benati DB2 Express-C 9 e MySQL Community Server a confronto DB2 Express-C 9 e MySQL Community Server a confronto

Software Libero e RDBMS - imolug.org · per IBM, con l’articolo “A Relational Model of ... permetta la gestione dei dati (come SQL). • Regola 6: si possono creare delle viste

  • Upload
    vuanh

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Software Libero e RDBMSSoftware Libero e RDBMS

Alessandro BenatiAlessandro Benati

DB2 Express-C 9 e MySQL Community Server a confrontoDB2 Express-C 9 e MySQL Community Server a confronto

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

RDBMSRDBMSIl termine Relational DataBase Relational DataBase Management SystemManagement System (RDBMSRDBMS), sistema relazionale per la gestione di basi di dati, indica un sistema basato sul modello relazionale (Entity/Relationship), introdotto da Edgar F. Codd nel 1970, mentre lavorava per IBM, con l’articolo “A Relational Model of “A Relational Model of Data for Large Shared Data Banks”Data for Large Shared Data Banks”.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

RDBMSRDBMS

• Regola 0: il sistema deve potersi definire come relazionale, base di dati e sistema di gestione. Affinché un sistema possa definirsi sistema relazionale per la gestione di basi di dati (RDBMS), tale sistema deve usare le proprie funzionalità relazionali (e solo quelle) per gestire la base di dati.

• Regola 1: l'informazione deve essere rappresentata sotto forma di tabelle.

• Regola 2: l’accesso ai dati deve essere garantito tramite la relazione tabella-chiave primaria e valore della chiave primaria.

• Regola 3: il sistema deve supportare i valori di NULL.

• Regola 4: la descrizione del database deve avvenire ad un livello logico tramite i metadati.

• Regola 5: deve esistere un linguaggio che permetta la gestione dei dati (come SQLSQL).

• Regola 6: si possono creare delle viste per vedere una parte dei dati. Queste viste devono essere aggiornabili.

• Regola 7: le operazioni che avvengono su database devono avvenire anche sulle tabelle.

• Regola 8: i dati memorizzati nel database devono essere indipendenti dalle strutture di memorizzazione fisiche

• Regola 9: i dati devono essere indipendenti dalla struttura logica del database per garantire la crescita naturale e la manutenzione del database.

• Regola 10: le restrizioni sui dati devono essere memorizzate nel database.

• Regola 11: l'accesso ai dati è indipendente dal tipo di supporto per la lettura o memorizzazione degli stessi.

• Regola 12: l'accesso ai dati non deve annullare le restrizioni o i vincoli di integrità del linguaggio principale (SQL).

Una nota definizione dei requisiti che un RDBMSRDBMS dovrebbe avere, è data dalle famose 12 regole di Codd12 regole di Codd.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Player di MercatoPlayer di MercatoPrima del 1994, se qualcuno avesse voluto un RDBMS SQL-based senza pagare uno sproposito, avrebbe dovuto desistere.Le soluzioni commerciali dominanti erano OracleOracle, SybaseSybase e InformixInformix.Questi database erano progettati per gestire “valanghe” di dati, erano potenti e pieni di funzioni, a scapito delle risorse e del TCOTCO.Mediamente le risorse necessarie a questi motori database erano dell’ordine delle decine di migliaia di dollari.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Player di MercatoPlayer di Mercato

.Product Maintainer Release

Date Latest Stable

Version Software License

4th Dimension 4D s.a.s 1984 v11 SQL Proprietary Adabas Software AG 1970 2006 Proprietary DB2 IBM 1982 9 Proprietary Informix IBM 1985 11.0 Proprietary

Ingres Ingres Corp. 1974 Ingres 2006 II

9.0.4 GPL and

proprietary InterBase CodeGear 1985 2007 Proprietary Microsoft Access Microsoft 1992 12 (2007) Proprietary Microsoft SQL Server Microsoft 1989

9.00.3042 (2005 SP2) Proprietary

Oracle Oracle Corporation 1979 11g Release 1

(September 2007) Proprietary

Oracle Rdb Oracle Corporation 1984 7.2 Proprietary

PostgreSQL PostgreSQL Global

Development Group 1989 8.2.5 BSD

SQL Anywhere Sybase 1992 10.0 Proprietary Teradata Teradata 1984 V2R8.2 Proprietary

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Un po’ di storiaUn po’ di storia

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

La comparsa di LinuxLa comparsa di Linux

Nel 1991 appare LinuxLinux, come risposta alle varie insoddisfazioni che Linus TorvaldsLinus Torvalds, un giovane programmatore finlandese, trovava in MinixMinix, un sistema operativo Unix-like a microkernel, creato da Andrew TanenbaumAndrew Tanenbaum nel 1987.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

La comparsa di LinuxLa comparsa di Linux

.Le principali critiche di Torvalds erano le seguenti:•Minix non era free softwarefree software e neanche completamente open sourceopen source;•sebbene portabile, non supportava appieno la nuova architettura i386 a 32bit.

Queste critiche sfociarono poi in un dibattito pubblico tra i due sul newsgroup comp.os.minix, dal titolo Linux is Linux is obsoleteobsolete.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

La comparsa di LinuxLa comparsa di Linux

.“Don`t get me wrong, I am not unhappy with LINUX. It will get all the people who want to turn MINIX in BSD UNIX off my back. But in all honesty, I would suggest that people who want a **MODERN** "free" OS look around for a microkernel-based, portable OS, like maybe GNU or something like that.“ - Andrew Tanenbaum

“I also agree that linux takes the non-portability to an extreme: I got my 386 last January, and linux was partly a project to teach me about it. Many things should have been done more portably if it would have been a real project. I'm not making overly many excuses about it though: it was a design decision, and last april when I started the thing, I didn't think anybody would actually want to use it. I'm happy to report I was wrong, and as my source is freely available, anybody is free to try to port it, even though it won't be easy.” - Linus Torvald

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Un po’ di storiaUn po’ di storia

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Un po’ di storia: Un po’ di storia: DB2DB2

DB2 ha una lunga storia ed è considerato in qualche modo il primo database a fare uso del linguaggio SQL, anche se il primo a sfruttare commercialmente le idee di CoddCodd fu Larry EllisonLarry Ellison, fondatore di OracleOracle, con grande “disappunto” da parte di IBM.La prima versione del prodotto con tale nome, risale al 1982, su piattaforma mainframe, successore del System R(elational) del 1978.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Un po’ di storia: Un po’ di storia: DB2DB2

Codd aveva anche pensato a un linguaggio relazionale, chiamato Alpha, per il database da lui pensato, ma per ragioni di scarsa lungimiranza il gruppo di sviluppo non fu posto sotto di lui.Il risultato di ciò fu che il gruppo produsse un linguaggio che violava molti dei suoi puntipunti.Tale linguaggio si chiamò inizialmente Structured English QUEry LanguageStructured English QUEry Language, SEQUELSEQUEL, nome poi cambiato in SQLSQL per ragioni di copyright.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Un po’ di storia: Un po’ di storia: MySQLMySQL

MySQL è legato in qualche modo alla tesi di dottorato di David Hughes, che scelse un database SQL come strumento per la raccolta dati del suo monitor di rete, chiamato Minerva.All’epoca fu giocoforza scegliere PostgresPostgres come DBMS, il quale supportava una variante di SQL non standard, denominata PostQUELPostQUEL. Fu così che Hughes scrisse un modulo che convertisse SQL standard in linguaggio PostQUEL. Tale prodotto fu chiamato mSQL (miniSQL)mSQL (miniSQL).

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Un po’ di storia: Un po’ di storia: MySQLMySQL

La crescita di Minerva rese insufficiente Postgres, a causa di limiti tecnologici, ciò indusse Hughes a rivalutare mSQLmSQL, aggiungendogli le funzioni di archiviazione e di ricerca dei dati, trasformandolo cioè in vero e proprio DBMS.Più tardi un altro sviluppatore, Michael Widenius, pensò di utilizzare mSQL per le sue applicazioni web, aggiungendo alcune ciò che all’epoca mSQL non aveva, ad esempio gli indici. Fu così che nacque MySQL 1.0MySQL 1.0

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Un po’ di storia: Un po’ di storia: MySQLMySQL

Con l'aiuto di Aladdin Peter Deutsch MySQLMySQL diventa "più libero” del predecessore mSQLmSQL e rappresenta il primo database “open” al mondo. Già dalla prima versione viene effettuato il porting per i sistemi Unix, Win32 e OS/2, al punto che si contavano circa 500.000 server MySQLMySQL.

Curiosità: pare sia incerta l’origine del nome, ma la più attendibile vuole che derivi dal soprannome della figlia di Widenius, My.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto!A Confronto!

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto!A Confronto!

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto: A Confronto: edizioniedizioni

.MySQL offre due versioni basate su GPL e due licenze commerciali:2.MySQL Standard (full transactional support database)3.MySQL Max (early adopters database with advanced features)4.MySQL Pro (commercially licensed version of MySQL Standard)5.MySQL Classic (commercially licensed, basic in-memory database)

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

DB2 copre un vasto range di applicazioni o piattaforme:2.DB2 Cloudscape (Java-based lightweight embed.)3.DB2 UDB for LUW

a)DB2 Express Edition (2 CPU, 4GB RAM, for SMB)

b)DB2 Workgroup Edition (4 CPU, no RAM limit)c)DB2 Enterprise Server Edition (Highly mission

critical applications & clusters)d)DB2 Personal Edition (for non commercial use)

4.DB2 z/OS (for IBM zSeries mainframes)5.DB2 for iSeries (for AS400 platforms)5.DB2 Everyplace (for mobile and PDA)

A Confronto: A Confronto: edizioniedizioni

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto: A Confronto: edizioniedizioni

DB2 Express-CDB2 Express-C is a freefree version of DB2 Express Edition (DB2 Express) for the community.It’s a no-chargeno-charge data server for use in development and deployment of applications including: XML, C/C++, Java, .NET, PHP, and more.DB2 Express-C can be run on up to 2 dual-core CPU servers, with up to 4 GB of memory, any storage system setup and with no restrictions on database size or any other artificial restrictions (Linux and Windows).

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto: A Confronto: featuresfeaturesSistemi Operativi Supportati Windows Mac OS X Linux BSD UNIX z/OS

DB2 Yes No Yes No Yes Yes

MySQL Yes Yes Yes Yes Yes Maybe

Caratteristiche fondamentali

ACID

Atomicity, Consistency, Isolation, Durability

Referential Integrity Transactions Unicode

DB2 Yes Yes Yes Yes

MySQL Yes* Yes* Yes* Yes*

Note: for transactions and referential integrity, the InnoDB table type must be used; Windows installer sets this as default if support for transactions is selected, on other operating systems the default table type is MyISAM. However, even the InnoDB table type permits storage of values that exceed the data range; some view this as violating the Integrity constraint of ACID.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto: A Confronto: featuresfeaturesLimiti

Max DB

size

Max table size

Max row size

Max cols per row

Max LOB size

Max CHAR size

Max NUMBER

size

DB2 512TB 512TB 32KB 1012 2GB 32KB 64 bits

MySQL Unlimited

2GB (FAT32) to 16TB (Solaris)

64KB 3398 4GB

(longtext, longblob)

64KB (text) 64 bits

Tabelle e viste

Temporary Table

Materialized View

DB2 Yes Yes

MySQL Yes No*

Note: materialized views can be emulated using stored procedures and triggers.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto: A Confronto: featuresfeaturesIndici

R- R+ tree

Hash Expr. Partial Reverse Bitmap GiST GIN

DB2 No Yes No No Yes Yes No No

MySQL MyISAM tables only

MEMORY

Cluster (NDB)

InnoDB tables only

No No No No No No

Proprietà DB

Union Inner Joins

Outer Joins

Inner Selects

Merge LOBs

DB2 Yes Yes Yes ? Yes Yes

MySQL Yes Yes Yes Yes Yes Yes

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto: A Confronto: featuresfeaturesAltri Oggetti Data

Domain Cursor Trigger Function Procedure External

Routine

DB2 No Yes Yes Yes Yes Yes

MySQL No Yes Yes Yes Yes Yes

Partitioning

Range Hash Composite

(Range+Hash) List Shadow

Native Replication

API

DB2 Yes Yes Yes Yes ? ?

MySQL Yes (5.1.6)

Yes (5.1.6)

Yes (5.1.6) Yes (5.1.6)

? ?

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Al Lavoro!Al Lavoro!

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto: setupA Confronto: setup

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

A Confronto: setupA Confronto: setup

rpm -i MySQL-rpm -i MySQL-server-server-

5.0.glibc23.i386.rpm5.0.glibc23.i386.rpm!!!!!!

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

ConclusioniConclusioni

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

ConclusioneConclusione“Nel 2006 avete pianificato il passaggio da database proprietario a Software Libero e/o Open Source?” In Europa il 40% ha risposto sì, il 60% in America Latina e il 50% in Asia. Questi dati, pubblicati da GartnerGartner, indicano un forte cambiamento preannunciato già negli scorsi anni dai sostenitori del software libero ed open. L’idea è che le soluzioni “aperte” crescono inesorabilmente e rubano fette di mercato alle grandi software house. Quest' idea, priva di credibilità per anni, sembra iniziare a spaventare molti.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

ConclusioneConclusione

. ResearchPublication Date: 2 May 2007 ID Number: G00148562

MySQL Will Open IBM System-i to New Applications and Customers

Donald Feinberg

MySQL's and IBM's plan for the MySQL database management system to run on the System i platform brings hundreds of new applications to System i and should be welcome news to small and midsize businesses.

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

LinksLinks•http://it.wikipedia.org/wiki/Edgar_F._Codd•http://it.wikipedia.org/wiki/12_regole_di_Codd•http://it.wikipedia.org/wiki/Linux•http://it.wikipedia.org/wiki/Minix•http://www-306.ibm.com/software/data/db2/express/download.html•http://dev.mysql.com/downloads/mysql/5.0.html•http://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems•http://www-it.mysql.com/company/legal/licensing/faq.html

LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007LinuxDays ’07 – Imola 27/10/2007 – Granarolo Faentino 3/11/2007

Grazie!Grazie!