Notice: MySQL is a registered trademark of Sun Microsystems, Inc. MySQL Conference & Expo 2011 Michael “Monty” Widenius Oleksandr “Sanja”

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizards Guide to PHP by David Lash.
Advertisements

CC SQL Utilities.
2010/11 : [1]Building Web Applications using MySQL and PHP (W1)MySQL Recap.
MySQL-Database Teppo Räisänen Oulu University of Applied Sciences School of Business and Information Management.
SQL Table Basics. Database Objects Tables Temporary tables (begin with #) Views Keys Indexes.
Creating Database Tables CS 320. Review: Levels of data models 1. Conceptual: describes WHAT data the system contains 2. Logical: describes HOW the database.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
DBMS 3. course. Reminder Data independence: logical and physical Concurrent processing – Transaction – Deadlock – Rollback – Logging ER Diagrams.
MySql In Action Step by step method to create your own database.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
Chapter 4 Introduction to MySQL. MySQL “the world’s most popular open-source database application” “commonly used with PHP”
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
CSC 2720 Building Web Applications Database and SQL.
Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.
Sizing Basics  Why Size?  When to size  Sizing issues:  Bits and Bytes  Blocks (aka pages) of Data  Different Data types  Row Size  Table Sizing.
MySQL More… 1. More on SQL In MySQL, the Information Schema is the “Catalog” in the SQL standard SQL has three components: Data definition Data manipulation.
Advanced Web 2012 Lecture 3 Sean Costain What is a Database? Sean Costain 2012 A database is a structured way of dealing with structured information.
Visual Programing SQL Overview Section 1.
GLOBEX INFOTEK Copyright © 2013 Dr. Emelda Ntinglet-DavisSYSTEMS ANALYSIS AND DESIGN METHODSINTRODUCTORY SESSION EFFECTIVE DATABASE DESIGN for BEGINNERS.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Sql DDL queries CS 260 Database Systems.
Access Lessons 1, 2 and 3 ©2009 M and K Solutions, LLC – All Rights Reserved.
>> Introduction to MySQL. Introduction Structured Query Language (SQL) – Standard Database Language – Manage Data in a DBMS (Database Management System)
DBMS 3. course. Reminder Data independence: logical and physical Concurrent processing – Transaction – Deadlock – Rollback – Logging ER Diagrams.
Class 3Intro to Databases Class 4 Simple Example of a Database We’re going to build a simple example of a database, which will allow us to register users.
Relational Databases and MySQL. Relational Databases Relational databases model data by storing rows and columns in tables. The power of the relational.
Access Lessons 1, 2 and 3 ©2009 M and K Solutions, LLC – All Rights Reserved.
Lecture 1.21 SQL Introduction Steven Jones, Genome Sciences Centre.
The purpose of a CPU is to process data Custom written software is created for a user to meet exact purpose Off the shelf software is developed by a software.
3 A Guide to MySQL.
CPSC-310 Database Systems
Databases.
CS320 Web and Internet Programming SQL and MySQL
INLS 623– Database Systems II– File Structures, Indexing, and Hashing
Data Definition and Data Types
MySQL-Database Jouni Juntunen Oulu University of Applied Sciences
MongoDB Er. Shiva K. Shrestha ME Computer, NCIT
Lesson 7 Managing Data Creating a database with Web Matrix.
Data Modeling and Database Design INF1343, Winter 2012 Yuri Takhteyev
Database Design and Implementation
Paul Jacobs The iSchool University of Maryland Thursday, Oct. 6, 2016
MIS2502: Data Analytics SQL – Putting Information Into a Database
Instant Add Columns in MySQL
ISC440: Web Programming 2 Server-side Scripting PHP 3
DATABASE MANAGEMENT SYSTEM
Chapter 8 Working with Databases and MySQL
CIS 136 Building Mobile Apps
A JSON’s Journey through SQL Server
Defining a Database Schema
Intro to Relational Databases
CIS16 Application Programming with Visual Basic
Paul Jacobs The iSchool University of Maryland Thursday, Oct. 5, 2017
CS3220 Web and Internet Programming SQL and MySQL
Physical Data Modeling – Implementation
ICOM 5016 – Introduction to Database Systems
Chapter 4 Introduction to MySQL.
Data.
Large Object Datatypes
MIS2502: Data Analytics SQL 4– Putting Information Into a Database
MySQL Database System Installation Overview SQL summary
CS3220 Web and Internet Programming SQL and MySQL
VIJAYA PAMIDI CS 257- Sec 01 ID:102
JDBC II IS
Presentation transcript:

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. MySQL Conference & Expo 2011 Michael “Monty” Widenius Oleksandr “Sanja” Byelkin MariaDB Dynamic Columns

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. RDBMS doesn't solve all common problems The (web) store problem: All items need: ID, Type, Price, Country, Manufacturer) A T-Shirt has the following additional properties: Size, color... A computer has the following additional properties: CPU, MHz, memory, Watt... There is no easy way to store many different types into a relational database!

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. RDBMS doesn't solve all common problems One common solutions to this is: ● Store all the 'extra' columns in a BLOB in some format (HTML?) ● You need a lot of extra work to manipulate the blob ● Hard to access column data (usually done in client) ● Overhead in storage (especially when you use HTML) ● All values are 'text'

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. RDBMS doesn't solve all common problems Another common solution: ● Create one table for all the 'extra' columns: CREATE TABLE extra (id int auto_increment, extra_column_id char(10), value varchar(255)); INSERT INTO items set type=“t-shirt”, price=10; INSERT INTO extra (NULL, LAST_INSERT_ID(), “color”, “Blue”),(NULL, LAST_INSERT_ID(), “Size”, “M”); The problems with this approach is: ● Every access to an extra column requires a key/row lookup ● Slow performance (if database is not optimized for this) ● Big overhead in storage (especially in index) ● Risk for errors as data is not typed

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns Dynamic columns is a bridge between relational databases and non relational databases ● With dynamic columns all extra columns are stored in a packed blob, maintained by the database. ● You can add more columns, remove or query them for a row. ● You can access columns in the server or retrieve the full blob to the client and manipulate it there. ● You can use virtual columns to create indexes on some values. ● True indexes for dynamic columns is planned for later. ● Implemented through functions for use by ODBC, & etc. ● First implementation uses integer to access columns.

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: supported types ● unsigned int ● int ● char [character set ] ● double ● decimal [(, )] ● time ● date ● datetime

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: syntax Creating a table with a dynamic column for the store: CREATE TABLE item ( ID int auto_increment primary key, Type_id int, Price decimal(7,2), Country_id int, Manufacturer_id int, extra blob); Where column 'extra' is dedicated to store dynamic columns. It could be any column able carry text.

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: syntax Creating/initializing a dynamic_column: COLUMN_CREATE(column_nr, value [as type], [column_nr, value [as type]],...) INSERT into item values (NULL, 1 /* T-shirt */, 10, 1 /* Germany */, 1 /* Nike */, COLUMN_CREATE(1 /* color */, "Blue", 2 /* Size */, "M")); INSERT into item values (NULL, 2 /* computer */, 1000, 1 /* Germany */, 2 /* intel */, COLUMN_CREATE(3 /* cpu */, "T9400", 5 /* MHz */, 800 as unsigned int)); The /*..*/ is just there to make the example clearer.

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: syntax Updating a dynamic column: COLUMN_ADD(string, column_nr, value [as type], column_nr, value [as type]]...) UPDATE item SET extra= COLUMN_ADD(extra, 6 /* Memory */, 2048) WHERE id=2; If the column already exists, it will be overwritten.

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: syntax Deleting a dynamic column (if it exists): COLUMN_DELETE(string, column_nr1, column_nr2,...); UPDATE item SET extra= COLUMN_DELETE(extra, 6) WHERE id=2;

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: syntax Querying a dynamic column: COLUMN_EXISTS(string, column_nr); SELECT ID, Type_id, Price, Country_id, Manufacturer_id from item where COLUMN_EXISTS(extra, 3); Querying which columns exist: COLUMN_LIST(string); SELECT COLUMN_LIST(extra) FROM item WHERE id=1; → “1,2”

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: syntax Retrieving a dynamic column: COLUMN_GET(column_nr, string as type); SELECT id, COLUMN_GET( 1 /* color*/, extra as char) from item; → 1 Blue → 2 NULL You can of course also do things like: SELECT id, COLUMN_GET(1, extra as char) FROM item where Type_id=1 order by COLUMN_GET(1, extra as char);

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: C library C Library allows the same manipulations with dynamic columns on the client side. A description can be found in the worklog and in the source.

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: encoding How is the dynamic column encoded? Header: Sorted index: Each column is stored as: Where 'offset' is offset from beginning of data part, 'type' is 3 bits in offset. Length of the data could be calculated by offsets of 2 neighbor fields.

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: data encoding ● Unsigned integer is just a variable integer field. ● Signed integer coded to make the variable size efficient: ● 0→0 ● -1→1 ● 1→2 ● -2→3 ● 2→4 ●... ● Double, date, time, and date time are fixed-size fields ● String stores collation number and the string ● Decimal stores sizes of parts before and after decimal point and decimal in MySQL format. ● NULL – means removing the field.

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: avaliability When will dynamic columns be available? First version is already pushed in separate tree for testing. lp:~maria-captains/maria/5.3-mwl34 Should be available in main MariaDB 5.3 within several weeks.

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Dynamic columns: plans ● Adding name directory ● Adding functional indices ● Supporting popular NoSQL data exchange formats (for example, JSON or XML) ● Adding engine support for NoSQL databases as HBase

Notice: MySQL is a registered trademark of Sun Microsystems, Inc. Thanks Q & A