Under the Hood with MySQL
-
Upload
ohiocore -
Category
Technology
-
view
2.177 -
download
1
description
Transcript of Under the Hood with MySQL
Under the Hood with MySQL
Joe Atzberger, LibLime
KohaCon 2009: Plano, TX
SQL Control
SQL Control
•Baseline: installer/data/mysql/kohastructure.sql
SQL Control
•Baseline: installer/data/mysql/kohastructure.sql
•Updates: installer/data/mysql/updatedatabase.pl
SQL Control
•Baseline: installer/data/mysql/kohastructure.sql
•Updates: installer/data/mysql/updatedatabase.pl
•This defines Koha’s Version!
SQL Control•mysqldump --no-data --xml -uyouruser -pyourpass koha_db >dump.sql
•~125 tables
•~1773 lines of XML
•That is a lot of stuff.
So what do you use to look at it all?
SQL Tools• phpMyAdmin: web based table control, a
great way to break everything and not be able to fix it.
• MySQL Administrator, MySQL Query Browser: Free and “official”.
• Tons of OSS applications. Varying quality.
• Tons of proprietary software. Varying cost.
I once performed a tech inventory for the State of Ohio in one of its smaller departments. The single largest line item was $427,000 for 7 boxes of Oracle software.
DB Design Principles
• Limit duplication of values
• Put related data together
• Proper data typing
• Keys, indexes, etc., etc., etc.
DB Design Principles
DB Design Principles
Does Koha do this?
DB Design Principles
Does Koha do this?
• Yes
DB Design Principles
Does Koha do this?
• Yes
• and No.
DB Design Problems• MARC: not a relational design.
• MARC: limits on record dimensions.
• MARC: performance implications.
• Battle of MARCs. Legacy code and data.
• FRBR, holdings, bindings, serials, etc.
• Excuses, excuses, excuses...
Core tables
Core tables• systempreferences: system preferences
Core tables• systempreferences: system preferences
• branches: the most frequently keyed table
Core tables• systempreferences: system preferences
• branches: the most frequently keyed table
• borrowers: users, patrons, staff, people, whomever
Core tables• systempreferences: system preferences
• branches: the most frequently keyed table
• borrowers: users, patrons, staff, people, whomever
• biblio: title level
Core tables• systempreferences: system preferences
• branches: the most frequently keyed table
• borrowers: users, patrons, staff, people, whomever
• biblio: title level
• biblioitems: marc & marcxml, going away soon
Core tables• systempreferences: system preferences
• branches: the most frequently keyed table
• borrowers: users, patrons, staff, people, whomever
• biblio: title level
• biblioitems: marc & marcxml, going away soon
• items: where the barcodes live
Parallel tables
• deletedxxx: biblios, items, biblioitems, borrowers
• old_xxx: old_issues, old_reserves. Need more.
Black Magicks
• marc_subfield_structure
• marc_tag_structure
You won’t be importing to any of these tables. Very application specific.
So what’s left?
• Paul covered structure
• Nicole handled queries
Pretty pictures?
Pretty pictures?
• http://wiki.koha.org/doku.php?id=en:development:dbschema:3.01
Pretty pictures?
• http://wiki.koha.org/doku.php?id=en:development:dbschema:3.01
• Not that pretty!
The End?