4. Database Design
A good database design is:
Divides your information into subject-
based tables to reduce redundant data.
Provides Access with the information it
requires to join the information in the
tables together as needed.
Can handle your data processing and
reporting needs.
5. Database Design
(cont’d)The design process consists of the following steps:
1. Determine the purpose of your database
This helps prepare you for the remaining steps.
2. Find and organize the information required
Gather all of the types of information you might want to
record in the database, such as product name and order
number.
3. Divide the information into tables
Divide your information items into major entities or
subjects, such as Products or Orders. Each subject then
becomes a table.
6. Database Design
(cont’d)4. Turn information items into columns
Decide what information you want to store in each table. Each item
becomes a field, and is displayed as a column in the table. For
example, an Employees table might include fields such as Last
Name and Hire Date.
5. Specify primary keys
Choose each table’s primary key. The primary key is a column that is
used to uniquely identify each row. An example might be Product ID
or Order ID.
6. Set up the table relationships
Look at each table and decide how the data in one table is related to
the data in other tables. Add fields to tables or create new tables to
clarify the relationships, as necessary.
7. Database Design
(cont’d)
7. Refine your design
Analyze your design for errors. Create the tables and add a few
records of sample data. See if you can get the results you want
from your tables. Make adjustments to the design, as needed.
8. Apply the normalization rules
Database normalization (or normalisation) is the process of
organizing the columns (attributes) and tables (relations) of a
relational database to minimize data redundancy.
The objective is to isolate data so that additions, deletions, and
modifications of an attribute can be made in just one table and
then propagated through the rest of the database using the
defined foreign keys.
10. Data Structures
In computer science, a data structure is a
particular way of organising data in a computer so
that it can be used efficiently.
Data Structures examples:
Primitive types (Boolean, Character, Double,
Integer …)
Composite types (Array …)
Abstract data types (List, Set, Stack, Queue,
Tree ...)
11. Big-O Notation
Big O notation is used in Computer
Science to describe the performance
or complexity of an algorithm.
Big O specifically describes the
worst-case scenario, and can be
used to describe the execution time
required or the space used (e.g. in
memory or on disk) by an algorithm.
24. Couchbase Conflicts
Molly creates DocumentA; the revision is 1-5ac
DocumentA is synced to Naomi's device; the latest
revision is still 1-5ac
Molly updates DocumentA, creating revision 2-54a
Naomi makes a different change to DocumentA,
creating revision 2-877
Revision 2-877 is synced to Molly's device, which
already has 2-54a, putting the document in conflict
Revision 2-54a is synced to Naomi's device, which
already has 2-877, similarly putting the local
document in conflict
25. Couchbase Conflicts
What if both devices make the same
change to the document? Is that a
conflict?
No. The revision ID is derived from
a digest of the document body. So if
two databases save identical
changes, they end up with identical
revision IDs, and Couchbase Lite
(and the Sync Gateway) treat these
as the same revision.
30. Couchbase
Performance (cont’d)There are few main variables that can impact
application performance which you can help control
and manage:
Getting cluster sizing correct for your application
load
Structuring documents for efficient reads/writes
Using SDK methods which are more efficient for
the operation you want to perform
Optimize your use of Couchbase client
connections
31. Structuring documents
Structuring documents for efficient
reads/writes
Effective (adj.) – Adequate to
accomplish a purpose; producing the
intended or expected result.
Efficient (adj.) – Performing or
functioning in the best possible
manner with the least waste of time
and effort.