Given at QCon London 2012
Your systems are going to fail, it might not be today, it might not be tomorrow, but sometime soon, probably at 2am, your systems are going to fail in new and exciting ways. We've shared at QCon before about the core architecture of guardian.co.uk, and how we built the site. Now we are going to tell you what we've learnt since we built it, in what ways it went wrong, and how we are learning to architect for failure at the very beginning of each project.
Data Modelling 101 half day workshop presented by Chris Bradley at the Enterprise Data and Business Intelligence conference London on November 3rd 2014.
Chris Bradley is a leading independent information strategist.
Contact chris.bradley@dmadvisors.co.uk
SQL212 Accelerated Introduction to SQL Using oracle. Covers create, alter, drop, insert, update, delete. Includes joins, inner and outer, subqueries, calculations and grouping.
Given at QCon London 2012
Your systems are going to fail, it might not be today, it might not be tomorrow, but sometime soon, probably at 2am, your systems are going to fail in new and exciting ways. We've shared at QCon before about the core architecture of guardian.co.uk, and how we built the site. Now we are going to tell you what we've learnt since we built it, in what ways it went wrong, and how we are learning to architect for failure at the very beginning of each project.
Data Modelling 101 half day workshop presented by Chris Bradley at the Enterprise Data and Business Intelligence conference London on November 3rd 2014.
Chris Bradley is a leading independent information strategist.
Contact chris.bradley@dmadvisors.co.uk
SQL212 Accelerated Introduction to SQL Using oracle. Covers create, alter, drop, insert, update, delete. Includes joins, inner and outer, subqueries, calculations and grouping.
How to manage a system in which the schema of data cannot be defined “a priori”? How to quickly search for entities whose data is on multiple lines? In this session we are going to address all these issues, historically among the most complex for those who find themselves having to manage yet very common and very delicate with regard to performance. From EAV to Sparse Columns, we'll see all the possible techniques to do it in the best way possible, from a usability, performance and maintenance points of view.
Wordnik's technical co-founder Tony Tam describes the reason for going NoSQL. During his talk Tony will discuss the selection criteria, testing + evaluation and successful, zero-downtime migration to MongoDB. Additionally details on Wordnik's speed and stability will be covered as well as how NoSQL technologies have changed the way Wordnik scales.
SQL201W Accelerated Introduction to SQL Using MySQL. Covers create, alter,drop, select, insert,update and delete. Includes joins, calculations and grouping.
The Quantum Internet: Hype or the Next StepJohn Ashmead
What do we mean by the quantum internet? Why do we need more than just quantum computing? What are quantum cryptography, quantum key distribution, quantum sensors? How are these concepts entangled? What are the advantages of the quantum internet? key problems? Who will get to use it? And do we have just a bunch of interesting technologies that all have quantum in their name or can the whole be more than the sum of its parts?
How to build a PostgreSQL-backed website quicklyJohn Ashmead
We will show how to get started building a PostgreSQL-backed website using Ruby-on-Rails. We will look at Model-View-Controller architecture; what tools you need to get started; how to work with the online tutorials; what kind of workflow to use; and which tasks to let Ruby-on-Rails handle versus which are better done by PostgreSQL.
How to manage a system in which the schema of data cannot be defined “a priori”? How to quickly search for entities whose data is on multiple lines? In this session we are going to address all these issues, historically among the most complex for those who find themselves having to manage yet very common and very delicate with regard to performance. From EAV to Sparse Columns, we'll see all the possible techniques to do it in the best way possible, from a usability, performance and maintenance points of view.
Wordnik's technical co-founder Tony Tam describes the reason for going NoSQL. During his talk Tony will discuss the selection criteria, testing + evaluation and successful, zero-downtime migration to MongoDB. Additionally details on Wordnik's speed and stability will be covered as well as how NoSQL technologies have changed the way Wordnik scales.
SQL201W Accelerated Introduction to SQL Using MySQL. Covers create, alter,drop, select, insert,update and delete. Includes joins, calculations and grouping.
The Quantum Internet: Hype or the Next StepJohn Ashmead
What do we mean by the quantum internet? Why do we need more than just quantum computing? What are quantum cryptography, quantum key distribution, quantum sensors? How are these concepts entangled? What are the advantages of the quantum internet? key problems? Who will get to use it? And do we have just a bunch of interesting technologies that all have quantum in their name or can the whole be more than the sum of its parts?
How to build a PostgreSQL-backed website quicklyJohn Ashmead
We will show how to get started building a PostgreSQL-backed website using Ruby-on-Rails. We will look at Model-View-Controller architecture; what tools you need to get started; how to work with the online tutorials; what kind of workflow to use; and which tasks to let Ruby-on-Rails handle versus which are better done by PostgreSQL.
The Quantum Internet: Hype or the Next StepJohn Ashmead
What do we mean by the quantum internet? Why do we need more than just quantum computing? What are quantum cryptography, quantum key distribution, quantum sensors? How are these concepts entangled? What are the advantages of the quantum internet? key problems? Who will get to use it? And do we have just a bunch of interesting tech that all have quantum in their name or can the whole be more than the sum of its parts?
Oz’s Tik-Tok to the Mechanical Turk, from Neural Nets & Genetic Algorithms to Chess & StarCraft, from fighting the Coronavirus to flying Killer Drones, from Facial Recognition to Fakes, Deep Fakes, & Anti-Fakes, Artificial Intelligence (AI) is everywhere today. How did it start? What do we mean by AI? What are the basic AI techniques? How is it being used? What are the benefits? risks? and how should we manage AI going forwards?
Time dispersion in time-of-arrival measurementsJohn Ashmead
Can we prove that the Heisenberg uncertainty principle does not apply along the energy/time axis in the same way it applies along the space/momentum axis?
Talk given at the International Association for
Relativistic Dynamics
Time dispersion in quantum mechanics -- Philcon 2019 versionJohn Ashmead
We know from quantum mechanics that space is fuzzy, that particles don’t have a well-defined position in space. And we know from special relativity that time and space are interchangeable. But if they are interchangeable, shouldn’t time be fuzzy as well? Shouldn’t the rules of quantum mechanics apply — along the time dimension? Bohr and Einstein — who disagreed on so much — nevertheless agreed on this.
Is time fuzzy? In quantum mechanics space is fuzzy. And in special relativity time and space are interchangeable. But if time and space are interchangeable, shouldnt time be fuzzy as well? Shouldnt quantum mechanics apply -- to time? Thanks to recent technical advances we can put this to the test. We ask: How do you get a clock in a box? How do you interfere with time? When is one slit better than two? And what happens at the intersection of time and quantum mechanics?
Why do we want to go? How do we get there? How do we live there? What might we find? What are the dangers: radiation, low gravity, dust, our fellow humans? Is there life on Mars now? Was there once? and did our own evolution actually start on Mars?
Practical Telepathy: The Science & Engineering of Mind-ReadingJohn Ashmead
From van Vogt's Slan to Willis's Crosstalk, telepathy has been a staple of science fiction. But what are the real world chances of reading another person's mind? With MRI & PET scans we can see what images a person is thinking of, with brain implants we can help the blind to see, and -- the way the science is going -- we are only a half-step away from direct mind-to-mind communication. Nothing to worry about here!
This is the Capclave 2018 version
From Startup to Mature Company: PostgreSQL Tips and techniquesJohn Ashmead
This talk is for people relatively new to PostgreSQL who are wondering:
How do I get going with PostgreSQL -- in a way that won’t create problems later on!
We’ll go over best practice in:
Table design
Indexing
PostgreSQL types
Stored procedures -- when & how to use, when not
Triggers
How to work with a web framework (i.e. Ruby-on-Rails): what works belongs in the framework, what should be done in the database
Error & exception management
Doing the right amount of planning
Why you might want to build the help system first, and use it to help build the rest.
Nistica has its ownership in Japan, engineering in New Jersey, & manufacturing in Vietnam so we’ll take a special look at:
Handling different languages & character sets
Timestamps & time zones
How to sync data from one part of the world to another without letting data fall on the floor or creating infinite loopiness.
Nistica has gone from startup to world player in the manufacture of optical switches. It has run its manufacturing on PostgreSQL from the start, using PostgreSQL to drive every step from assembly to quality assurance & tracking all part data in the database.
Going from the ad hoc procedures appropriate for a startup to the disciplined approaches required by the world market has taught us a lot about how to get the best out of PostgreSQL.
We’ve learned a lot from the PostgreSQL community; now we’d like to share some of what we’ve learned from our experience.
Practical Telepathy: The Science & Engineering of Mind-ReadingJohn Ashmead
From van Vogt's Slan to Willis's Crosstalk, telepathy has been a staple of science fiction. But what are the real world chances of reading another person's mind? With MRI & PET scans we can see what images a person is thinking of, with brain implants we can help the blind to see, and -- the way the science is going -- we are only a half-step away from direct mind-to-mind communication. Nothing to worry about here!
What are StarGates? Why & wither wormholes? Dangers of sphaghettification. How to build a wormhole? Negative energy & vortices. At the edge of testable. Today, a bridge of birds, tomorrow the cell phone: nearly impossible today, but tomorrow?
Call them Stargates, Jumpgates, Fargates, Hypergates or just an invitation to every unwanted pest from the far reaches of the Galaxy to visit, they're absolutely necessary if we're to have the glorious Science Fiction action we desperately need. Could they actually be built? Modern physics may permit: how to glue black holes together to build a wormhole, how to avoid the dangers of spaghettification, radiation poisoning and paradox noise, and just what would it take to build one in practice.
Quantum dots (QD) are semiconductors made via several possible routes. John Ashmead discusses how they are made, their properties and their applications in research.
Call them Stargates, Jumpgates, Fargates, Hypertubes or just an invitation to every unwanted pest from the far reaches of the Galaxy to visit, they are absolutely necessary if we are to have the glorious Science Fiction action we desperately need. But could they actually be built? We look at what modern physics has to say: how to glue black holes together to build a wormhole, how to avoid the dangers of spaghettification, radiation poisoning, and paradox noise, and just what it would take to build one in practice.
Time travel in the works of Tim Powers: The Anubis Gates, Three Days to Never, The Medusa's Web. Talk given at Washington DC Science Fiction convention, Capclave 2016.
We look at the history of the multiverse, the big bang theory, the problem of fine-tuning, how it is solved by the anthropic principle, how the combination of eternal inflation & string theory might create many universes, and a bit of discussion as to the odds of the multiverse being true.
We review the double slit experiment, the "central mystery" of quantum mechanics as Feynman put it. We included a number of animations, including some from Larry Latham specially done for this presentation! Unfortunately the animations don't seem to post correctly to slideshare, alas.
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.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
2. Introduction
• When were databases invented?
• What is a relational database?
• Why do you want to use a
relational database?
• What relational DB’s are there?
• What is MySQL?
• Why use MySQL?
• Why MySQL 5.0?
Monday, May 21, 2012
3. The first database
• Sumeria (Iraq)
• 2313BC
• For taxes (for
irrigation works)
• Counters &
envelopes &
markers, oh my!
Monday, May 21, 2012
4. What is relational?
• Everything
in tables
• Tables just
rows and
columns
• Fields are
atomic
Monday, May 21, 2012
5. Why go relational?
pat# name
1 Ann
• Simple
2 Betty • Explicit
• Flexible
pat# preg# pat# preg# • And fast
1 1 1 1 enough
1 2 1 2
2 1 2 1
2nd copy of table!
Monday, May 21, 2012
6. Relational databases
today
• Oracle
• SQL Server
• DB2, Informix
• MySQL
• Access, Filemaker
• Ad hockery
Monday, May 21, 2012
7. What is MySQL?
Open
source
Has all
needed
high end
features
Well-documented
Monday, May 21, 2012
8. Why use MySQL?
• Reliable
• Fast
• Cheap
• Easy to use
• Widespread
The four dog personality factors were energy
• Fixable
levels, affection-aggression, anxiety-calmness
and intelligence-stupidity.
Monday, May 21, 2012
9. Such as:
MySQL now Stored
has the features procedures
needed by even Transactions
the most
sofiztikated
Triggers
business-types. Views
& Point-time-
restore!
Monday, May 21, 2012
10. Installation & Setup
• Download
from
mysql.com
• Run startup
utility
• Has
Administrator
and Query
GUI’s
Monday, May 21, 2012
11. SQL Interface
mysql> SELECT VERSION(),
CURRENT_DATE;
+----------------+--------------+
| VERSION() | CURRENT_DATE |
+----------------+--------------+
| 5.0.7-beta-Max | 2005-07-11 |
+----------------+--------------+
1 row in set (0.01 sec)
Monday, May 21, 2012
12. Creating a database
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
mysql> create database menagerie;
mysql> use menagerie;
Database changed
Monday, May 21, 2012
13. What is a table?
• Nothing but
rows and
columns
• Types of
fields
• Nulls
• Constraints
• Indexes
Monday, May 21, 2012
14. How is a table stored?
MyISAM manages non-transactional tables. It provides high-speed storage and retrieval, as well as
fulltext searching capabilities. MyISAM is supported in all MySQL configurations, and is the default
storage engine unless you have configured MySQL to use a different one by default.
• The MEMORY storage engine provides in-memory tables. The MERGE storage engine allows a collection
of identical MyISAM tables to be handled as a single table. Like MyISAM, the MEMORY and
MERGE storage engines handle non-transactional tables, and both are also included in MySQL by default.
• The InnoDB and BDB storage engines provide transaction-safe tables. BDB is included in MySQLMax
binary distributions on those operating systems that support it. InnoDB is also included by default
in all MySQL 5.0 binary distributions.
• The EXAMPLE storage engine is a “stub” engine that does nothing. You can create tables with this
engine, but no data can be stored in them or retrieved from them. The purpose of this engine is to
serve as an example in the MySQL source code that illustrates how to begin writing new storage engines.
As such, it is primarily of interest to developers.
• NDB Cluster is the storage engine used by MySQL Cluster to implement tables that are partitioned
over many computers. It is available in MySQL-Max 5.0 binary distributions. This storage
engine is currently supported on Linux, Solaris, and Mac OS X only. We intend to add support for
this engine on other platforms, including Windows, in future MySQL releases.
• The ARCHIVE storage engine is used for storing large amounts of data without indexes with a very
small footprint.
• The CSV storage engine stores data in text files using comma-separated values format.
• The BLACKHOLE storage engine accepts but does not store data and retrievals always return an empty set.
• The FEDERATED storage engine was added in MySQL 5.0.3. This engine stores data in a remote
database. Currently, it works with MySQL only, using the MySQL C Client API. In future releases,
we intend to enable it to connect to other data sources using other drivers or client connection methods.
Monday, May 21, 2012
15. How/why do we index
a table?
• Balanced trees
are the most
common
• When records
are inserted/
deleted page
splits can
happen
Monday, May 21, 2012
16. How to create a table
mysql> CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
-> species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
mysql> SHOW TABLES;
+---------------------+
| Tables in menagerie |
+---------------------+
| pet |
+---------------------+
mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name | varchar(20) | YES | | NULL | |
| owner | varchar(20) | YES | | NULL | |
| species | varchar(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| birth | date | YES | | NULL | |
| death | date | YES | | NULL | |
Monday, May 21, 2012
17. Types of fields
• Numbers
• Strings
• Dates
• Blobs/Text
• Enum/Sets
Monday, May 21, 2012
18. What is a null
• Null means unknown
• is null, is not null
mysql> SELECT 1 = NULL, 1 <> NULL, 1 < NULL, 1 > NULL;
+----------+-----------+----------+----------+
| 1 = NULL | 1 <> NULL | 1 < NULL | 1 > NULL |
+----------+-----------+----------+----------+
| NULL | NULL | NULL | NULL |
+----------+-----------+----------+----------+
mysql> SELECT 1 IS NULL, 1 IS NOT NULL;
+-----------+---------------+
| 1 IS NULL | 1 IS NOT NULL |
+-----------+---------------+
| 0 | 1 |
+-----------+---------------+
And why are we
afraid of them?
Monday, May 21, 2012
20. Normalization
• First normal
form
• Second normal
form
• Third normal
form
Monday, May 21, 2012
21. First normal form
First normal form
To understand first normal form (1NF), consider these two
examples of things you might know:
"What is your favorite color?"
"What food will you not eat?"
A difference between these two questions is that, while you can
have only one favorite color, there may be many foods you do
not eat.
In "1NF"; Every attribute in a relation must be atomic. That is to
say that there can be no composite attributes in the relation.
Data that has a single value such as "person's favorite color" is
inherently in first normal form. Such data can be stored in a
single table with a simple key/value combination. Data that has
multiple values, however, must be stored differently.
Codd argued that there was one best way to keep multi-valued
data such as "food a person will not eat." He suggested that the
database should contain a separate table for the multi-value
data and then store each food as a separate row in that table.
Known as first normal form, this approach has been a standard
for decades.
Monday, May 21, 2012
22. Second normal form
Second normal form (2NF) prescribes full functional dependency on the primary key. It most commonly applies to
tables that have composite primary keys, where two or more attributes comprise the primary key. It requires that
there are no non-trivial functional dependencies of a non-key attribute on a part (subset) of a candidate key. A table
is said to be in the 2NF if and only if it is in the 1NF and every non-key attribute is irreducibly dependent on the
primary key (i.e. not partially dependent on candidate key).
Consider a table named part describing machine parts with the following attributes:
PART_NUMBER (PRIMARY KEY)
SUPPLIER_NAME (PRIMARY KEY)
PRICE
SUPPLIER_ADDRESS
The PART_NUMBER and SUPPLIER_NAME form the composite primary key, because the same part can be supplied
by multiple suppliers. In this example, PRICE is correctly placed on the part table, because it is fully dependent on
the primary key i.e. different suppliers will charge a different price for the same part.
SUPPLIER_ADDRESS, however, is only dependent on the SUPPLIER_NAME, and therefore this table breaks 2NF.
This attribute should be placed on a second table named supplier comprising:
SUPPLIER_NAME (PRIMARY KEY)
SUPPLIER_ADDRESS
In order to find if a table is in 2NF, ask whether any of the non-key attributes of the table could be derived from a
subset of the composite key, rather than the whole composite key. If the answer is yes, it's not in 2NF. This is solved
sometimes by using a correlation file, such as the supplier table above.
Easily understood definition: A unique key. A column of values that uniquely identify each row in each table.
Monday, May 21, 2012
23. Third normal form
Third normal form (3NF) requires that the table is in 2NF, and that there are no non-trivial functional
dependencies of non-key attributes on something other than a superset of a candidate key. A table is in 3NF if
none of the non-primary key attributes is a fact about any other non-primary key attribute. In summary, all non-key
attributes are mutually independent (i.e. there should not be transitive dependencies).
Consider a table that defines a machine part as having the following attributes.
PART_NUMBER (PRIMARY KEY)
MANUFACTURER_NAME
MANUFACTURER_ADDRESS
In this case, the manufacturer address does not belong on this table, because it is a fact about the manufacturer of
the part, rather than the part itself. MANUFACTURER_ADDRESS should therefore be moved into a separate table
with the attributes:
MANUFACTURER_NAME (PRIMARY KEY)
MANUFACTURER_ADDRESS
...and the original table should be redefined as:
PART_NUMBER (PRIMARY KEY)
MANUFACTURER_NAME
The problem with a table not being in 3NF is that for every MANUFACTURER_NAME we have to maintain a
redundant MANUFACTURER_ADDRESS (i.e. an address for each part_number, rather than one for each
MANUFACTURER_NAME).
Easily understood definition: Ensures that each table contains unique data. In other words, it ensures that a
table of customer identification data does not contain order data, and so on.
Monday, May 21, 2012
24. Update/delete
anomalies
If data is not fully normalized, then there
will be update/delete anomalies.
To change a piece of information, you may
have to update in two or more places.
If you remove the last piece of information
in one table, you may destroy all
information about the parent.
Monday, May 21, 2012
25. SQL/DML
The life-cycle of data
Inserts, Selects,
Bulk inserts Views
Updates,
Deletes Transactions,
Locking
Monday, May 21, 2012
26. Insert/bulk insert
mysql> INSERT INTO pet VALUES
('Puffball','Diane','hamster','f','1999-03-30',NULL);
mysql> insert into pet values ('Wally', 'Joan the
Mad', 'unicorn', 'm', '2000-01-02', null);
mysql> LOAD DATA LOCAL INFILE '/path/
-> LINES TERMINATED BY 'r';
Monday, May 21, 2012
27. Select
SELECT what_to_select
FROM which_table
WHERE conditions_to_satisfy;
mysql> select * from pet where name = 'Wally';
+-------+--------------+---------+------+------------+-------+
| name | owner | species | sex | birth | death |
+-------+--------------+---------+------+------------+-------+
| Wally | Joan the Mad | unicorn | m | 2000-01-02 | NULL |
+-------+--------------+---------+------+------------+-------+
Monday, May 21, 2012
28. Selects (2)
mysql> SELECT pet.name,
-> (YEAR(date)-YEAR(birth)) - (RIGHT(date,5)<RIGHT(birth,5)) AS
age,
-> remark
-> FROM pet, event
-> WHERE pet.name = event.name AND event.type = 'litter';
+--------+------+-----------------------------+
| name | age | remark |
+--------+------+-----------------------------+
| Fluffy | 2 | 4 kittens, 3 female, 1 male |
| Buffy | 4 | 5 puppies, 2 female, 3 male |
| Buffy | 5 | 3 puppies, 3 female |
+--------+------+-----------------------------+
Monday, May 21, 2012
29. Update
mysql> UPDATE pet set death = “2006-02-04” WHERE name =
'Bowser';
1 rows updated
mysql> SELECT * FROM pet WHERE name = 'Bowser';
+--------+-------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+--------+-------+---------+------+------------+------------+
| Bowser | Diane | dog | m | 1989-08-31 | 1995-07-29 |
+--------+-------+---------+------+------------+------------+
Monday, May 21, 2012
30. Transactions
begin work;
• What is a
update account set balance = transaction?
balance + $1000
where account_n = 123 and type =
‘checking’; • Why are they
update account set balance = needed?
balance - $1000
where account_n = 123 and type =
‘savings’; • ACID
commit work;
• How is it
implemented?
Monday, May 21, 2012
31. Atomicity, Consistency, Isolation, and Durability
In databases, ACID stands for Atomicity, Consistency, Isolation, and Durability. They are considered to be the key transaction processing
features/properties of a database management system, or DBMS. Without them, the integrity of the database cannot be guaranteed. In practice,
these properties are often relaxed somewhat to provide better performance.
In the context of databases, a single logical operation on the data is called a transaction. An example of a transaction is a transfer of funds from
one account to another, even though it might consist of multiple individual operations (such as debiting one account and crediting another). The
ACID properties guarantee that such transactions are processed reliably.
•
Atomicity refers to the ability of the DBMS to guarantee that either all of the tasks of a transaction are performed or none of them are. The
transfer of funds can be completed or it can fail for a multitude of reasons, but atomicity guarantees that one account won't be debited if
the other is not credited as well.
•
Consistency refers to the database being in a legal state when the transaction begins and when it ends. This means that a transaction
can't break the rules, or integrity constraints, of the database. If an integrity constraint states that all accounts must have a positive
balance, then any transaction violating this rule will be aborted.
•
Isolation refers to the ability of the application to make operations in a transaction appear isolated from all other operations. This means
that no operation outside the transaction can ever see the data in an intermediate state; a bank manager can see the transferred funds on
one account or the other, but never on both—even if she ran her query while the transfer was still being processed. More formally,
isolation means the transaction history (or schedule) is serializable. For performance reasons, this ability is the most often relaxed
constraint. See the isolation article for more details.
•
Durability refers to the guarantee that once the user has been notified of success, the transaction will persist, and not be undone. This
means it will survive system failure, and that the database system has checked the integrity constraints and won't need to abort the
transaction. Typically, all transactions are written into a log that can be played back to recreate the system to its state right before the
failure. A transaction can only be deemed committed after it is safely in the log.
Implementing the ACID properties correctly is not simple. Processing a transaction often requires a number of small changes to be made,
including updating indices that are used by the system to speed up searches. This sequence of operations is subject to failure for a number of
reasons; for instance, the system may have no room left on its disk drives, or it may have used up its allocated CPU time.
Monday, May 21, 2012
32. Locking
• What is locking?
• Row level locking
• Page level locking
• Table level locking
• Database locking
how to insert a kiwi…
Monday, May 21, 2012
33. Dining philosophers &
the deadly embrace
• Two processes
want the same
thing
• But in different
orders
• Oops…
Monday, May 21, 2012
34. Delete
mysql> select count(*)
from pet where name =
'Wally';
mysql> delete from pet
where name = 'Wally';
Monday, May 21, 2012
35. Stored procedures
• What are stored procedures
• Why they are God’s gift to database
programmers
• How to write a stored procedure
• How to debug
Monday, May 21, 2012
36. Why they are good
• Performance
• Maintainability
• Security
Monday, May 21, 2012
37. mysql> CREATE PROCEDURE simpleproc (OUT param1 INT)
-> BEGIN
-> SELECT COUNT(*) INTO param1 FROM t;
-> END;
Query OK, 0 rows affected (0.00 sec)
mysql> CALL simpleproc(@a);
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @a;
+------+
| @a |
+------+
| 3 |
+------+
1 row in set (0.00 sec)
mysql> CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50)
-> RETURN CONCAT('Hello, ',s,'!');
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT hello('world');
+----------------+
| hello('world') |
+----------------+
Stored Procedures and Functions
1059
Monday, May 21, 2012
38. How to debug
• Plan with failure in
mind
• Write clean code
• Build tests first
• Build in debugging
Monday, May 21, 2012
39. Overcoming
performance anxiety
• Query plans
• Preventing poor
performance
• Acts of madness/acts
of desperation
Monday, May 21, 2012
40. Explain
mysql> explain select * from pet;
+----+-------------+-------+--------+---------------+
| id | select_type | table | type | possible_keys |
+----+-------------+-------+--------+---------------+
| 1 | SIMPLE | pet | system | NULL |
+----+-------------+-------+--------+---------------+
• Most important: order of tables
• Rule based optimizer
• “Explain table” will show statistics for table
• Do “explain select” to get a feel for query plans
Monday, May 21, 2012
41. Proper Prior Planning
Prevents Pathetically Poor
• Clean database design
• Correct indexing
• Appropriate use of referential integrity
• Render unto server what is owed to server
Monday, May 21, 2012
42. Acts of desperation/
• Omit needless tasks. Omit needless tasks. Omit…
• Buy more RAM
• Measure before and after tuning
• Act locally; think globally
• Cache frequently needed data
• Partition in space & in time
Monday, May 21, 2012
43. Security
• Database level
security
• Table level
security
• General
principles of
security
Monday, May 21, 2012
44. Database security
• Root user
password
• Permissions on
the data files
Monday, May 21, 2012
45. Users and permissions
• Define users
• Grant/revoke permissions
• On tables and even individual columns
• For select, insert, update, delete,…
• Need overall plan
Monday, May 21, 2012
46. Principles of security
• Least privilege
• Clean design
• No unnecessary interactions between
users
• Well-defined roles
• Thorough logging
Monday, May 21, 2012
47. Backups
• Restore
philosophies
• Types of
backups
• Backup tools
Monday, May 21, 2012
48. Restore philosophies
• Disaster recovery
• Database failure
• User error
Monday, May 21, 2012
49. Types of backups
• Full database backup
• Log backups
• Asci table/data backup
• Special backups, i.e. of configuration files or
for particular projects
• Replication
Monday, May 21, 2012
50. Backup tools
• mysql is a command-line client for executing SQL statements
interactively or in batch mode.
• mysqladmin is an administrative client.
• mysqlcheck performs table maintenance operations.
• mysqldump and mysqlhotcopy make database backups.
• mysqlimport imports data files.
• mysqlshow displays information about databases and tables.
Monday, May 21, 2012
51. Under the hood
• Transaction logs
• Server process
• Database structures
Monday, May 21, 2012
52. Transaction logs
The binary log contains all statements that update data or potentially could have updated it (for example,
• Begin work
a DELETE which matched no rows). Statements are stored in the form of “events” that describe the
modifications. The binary log also contains information about how long each statement took that updated
data.
Note: The binary log has replaced the old update log, which is no longer available as of MySQL 5.0.
• Insert/update/
The binary log contains all information that is available in the update log in a more efficient format and
in a manner that is transaction-safe. If you are using transactions, you must use the MySQL binary log
for backups instead of the old update log.
The binary log does not contain statements that do not modify any data. If you want to log all statements
(for example, to identify a problem query), use the general query log. See Section 5.12.2, “The General
Query Log”.
delete
The primary purpose of the binary log is to be able to update databases during a restore operation as
fully as possible, because the binary log contains all updates done after a backup was made. The binary
log is also used on master replication servers as a record of the statements to be sent to slave servers. • Commit/
rollback
See Chapter 6, Replication in MySQL.
Running the server with the binary log enabled makes performance about 1% slower. However, the
benefits of the binary log for restore operations and in allowing you to set up replication generally
outweigh this minor performance decrement.
Monday, May 21, 2012
53. Server process
• Client/server
architecture
• Clients
• Connection
methods
• Server
• Actual data
Monday, May 21, 2012
54. Database structures
$ pwd
/usr/local/mysql
$ ls -l
total 88
-rw-r--r-- 1 root wheel 19071 Dec 21 14:39 COPYING
-rw-r--r-- 1 root wheel 5712 Dec 21 21:02 EXCEPTIONS-CLIENT
-rw-r--r-- 1 root wheel 7937 Dec 21 21:02 INSTALL-BINARY
-rw-r--r-- 1 root wheel 1379 Dec 21 14:39 README
drwxr-xr-x 50 root wheel 1700 Feb 8 22:03 bin
-rwxr-xr-x 1 root wheel 801 Dec 21 21:15 configure
drwxr-x--- 10 mysql wheel 340 Feb 10 06:09 data
drwxr-xr-x 4 root wheel 136 Feb 8 22:03 docs
drwxr-xr-x 62 root wheel 2108 Feb 8 22:03 include
drwxr-xr-x 10 root wheel 340 Feb 8 22:03 lib
drwxr-xr-x 3 root wheel 102 Dec 21 21:15 man
drwxr-xr-x 13 root wheel 442 Feb 8 22:03 mysql-test
drwxr-xr-x 3 root wheel 102 Feb 8 22:03 scripts
drwxr-xr-x 5 root wheel 170 Feb 8 22:03 share
drwxr-xr-x 31 root wheel 1054 Feb 8 22:03 sql-bench
drwxr-xr-x 14 root wheel 476 Feb 8 22:03 support-files
drwxr-xr-x 21 root wheel 714 Feb 8 22:03 tests
Monday, May 21, 2012
55. Hey, dude, where’s my
data?
# pwd
/usr/local/mysql/data/menagerie
# ls -l
total 48
-rw-rw---- 1 mysql wheel 65 Feb 8 22:09 db.opt
-rw-rw---- 1 mysql wheel 68 Feb 10 08:54 pet.MYD
-rw-rw---- 1 mysql wheel 1024 Feb 10 08:54 pet.MYI
-rw-rw---- 1 mysql wheel 8720 Feb 8 22:56 pet.frm
Monday, May 21, 2012
57. Summary
• Advantages of MySQL
• Principles of good design
• Where to go next
Monday, May 21, 2012
58. Advantages of MySQL
• Easy to download and install
• Reliable, fast, reasonably easy to use
• Has all needed features
• In widespread use
Monday, May 21, 2012
59. Principles of good
design
• Correct normalization
• Good use of database features
• Appropriate monitoring
• Act locally, think globally
Monday, May 21, 2012
60. Where to go next
• www.mysql.com
• MySQL Reference
Manual
• MySQL in a Nutshell,
Russell J. T. Dyer
• MySQL, Paul Dubois
Monday, May 21, 2012