O Numeric – Integers, Floating-Point, Fixed-Point and Bit- fieldO Character – Text stringsO Binary – Binary data stringsO Temporal – Time and Dates
• Decimal(p,s) – 4 Bytes per 9 digits – P: Max 65 - S: Max 30• BIT(n)– 1Byte per 8 digits
O MyISAMO InnoDBO MemoryO ArchiveO BlackHoleO CSV
O Represents each table using three files: O A format file--stores the definition of the table structure (mytable.frm) O A data file--stores the contents of table rows (mytable.MYD) O An index file that stores any indexes on the table (mytable.MYI)O The most flexible AUTO_INCREMENT column handling of all the storage enginesO Can be converted into fast, compressed, read-only tables to save spaceO Manages contention between queries for MyISAM table access using table-level lockingO Supports FULLTEXT searching and spatial data typesO Supports for geometric spatial extensionsO The table storage format is portable, so table files can be copied directly to another host and used by a server thereO Can improve performance by limiting table size to a certain number of rowsO When loading data into an empty table, updating of non-unique indexes can be disabled and then reenabled after loading the dataO Tables take up very little space
PROsO Max. tablesize 65535 TB (unless constrained by OS or file system)O Low storage cost (efficient storage handling)O Support for B-Tree, FullText, and spatial indexesO Very fast insert performanceO Very fast query performanceO Maintains accurate count of number of rows stored in table (SELECT COUNT(*) very fast).O Support for prefix-length index keys CONsO No support for transactionsO Table-level lockingO No crash recoveryO Blocking online backupO No support for foreign key constraints
O Each InnoDB table is represented on disk by an .frm format file in the database directory, as well as data and index storage in the InnoDB tablespace: O The tablespace is a set of files (1 or more) that InnoDB uses to store data and indexes O By default, InnoDB uses a single tablespace that is shared by all tables O Table sizes can exceed the maximum file size allowed by the filesystem O Can configure InnoDB to create each table with its own tablespaceO Supports transactions, with COMMIT and ROLLBACKO Provides full ACID complianceO Provides auto-recovery after a crash of the MySQL serverO Row level locking with MVCC (Multi-Versioning Concurrency Control) and non- locking readsO Supports foreign keys and referential integrity, including cascaded deletes and updatesO Supports consistent and online logical backup
PROsO ACID-compliantO Support for crash recoveryO High storage limit (64TB per tablespace, practically limited by file system)O Unlimited row-level lockingO Support for foreign key constraintsO MVCC supportO Clustered, B+Tree index supportO MySQL-supplied online, non-blocking backupO Advanced memory cache mechanisms CONsO No full-text or spacial index supportO Faster online logical backup utility an add-on cost option (Hot Backup)O Requires more disk and memory resources
O Each table is represented on disk by an .frm format file in the database directory. Table data and indexes are stored in memoryO In-memory storage results in very fast performanceO Contents do not survive a restart of the server (structure survives, but table contains zero rows)O Limited by max_heap_table_size so they do not get too largeO MySQL manages query contention using table-level locking. Deadlock cannot occur.O Cannot contain TEXT or BLOB columnsO Can use different character sets for different columns
PROsO Extremely fast read and write operationsO Support for tree and hash indexesO Main memory database management CONsO Data is not persistent between server shutdown’sO No support for transactionsO No support for foreign keysO No full-text or spatial index supportO Table level lockingO Cannot store BLOB or Text data
O Each table is represented on disk only by an .frm format file in the database directory.O Data and metadata files have extensions of .ARZ and .ARM, respectively.O Does not support indexes.O Supports INSERT and SELECT, but not DELETE, REPLACE, or UPDATE.O Supports ORDER BY operations, BLOB columns, and basically all but spatial data types.O Uses row-level locking.O Supports AUTO_INCREMENT columns.
O Each table is represented on disk by an .frm format file in the database directory.O Data file (plain text) has a .csv extension, and is in comma-separated values format.O Metadata files are created with the extension .csm.O Does not support indexes.O Data can be copied from the database directly and transferred to a client such as a spreadsheet application, and the table may be opened in a spreadsheet format.
O Verification of dump file syntax.O Measurement of the overhead from binary logging, by comparing performance using BLACKHOLE with and without binary logging enabled.O BLACKHOLE is essentially a "no-op" storage engine, so it could be used for finding performance bottlenecks not related to the storage engine itself.
DELIMITER $$CREATE EVENT copyProcesslist2ON SCHEDULE EVERY 1 SECONDSTARTS 2012-03-31 10:00:00ENDS 2012-04-01 10:00:00ON COMPLETION PRESERVEDISABLEDO BEGIN REPLACE INTO world.processlist SELECT * FROM information_schema.processlist; END;END$$
DELIMITER $$CREATE PROCEDURE `principal`.`calculaSaldo` (IN conta INT )BEGIN SELECT count(saldo) FROM extrato WHERE idConta = conta;END$$
O ALL and ALL PRIVILEGES are shorthand for "all privileges except GRANT OPTION." That is, they are shorthand for granting all privileges except the ability to give privileges to other accounts.