- •Contents
- •Preface
- •Why Do We Need Databases?
- •What’s Up in the Kingdom?
- •A Database—That’s Our Solution!
- •Summary
- •Database Terms
- •Relational Databases
- •Types of Data Models
- •Data Extraction Operations
- •Questions
- •The Relational Database Prevails!
- •Summary
- •Answers
- •The E-R Model
- •Normalizing a Table
- •What Is the E-R Model?
- •How to Analyze the E-R Model
- •Normalizing a Table
- •Steps for Designing a Database
- •Answers
- •Using SQL
- •Searching for Data Using a SELECT Statement
- •Using Aggregate Functions
- •Joining Tables
- •Creating a Table
- •SQL Overview
- •Searching for Data Using a SELECT Statement
- •Creating Conditions
- •Aggregate Functions
- •Searching for Data
- •Joining Tables
- •Creating a Table
- •Summary
- •Answers
- •What Is a Transaction?
- •What Is a Lock?
- •Database Security
- •Speeding Things Up with Indexing
- •Disaster Recovery
- •Properties of Transactions
- •When Disaster Strikes
- •Indexes
- •Optimizing a Query
- •Summary
- •Answers
- •Databases in Use
- •Databases and the Web
- •Distributed Databases
- •Stored Procedures and Triggers
- •Databases on the Web
- •What Is a Distributed Database?
- •Partitioning Data
- •Preventing Inconsistencies with a Two-Phase Commit
- •Database Replication
- •Further Application of Databases
- •Summary
- •Answers
- •Closing Remarks
- •References
- •Index
- •About the Author
- •Updates
- •More Manga Guides
Speeding Things Up with Indexing
|
|
I see your |
|
As the database grows |
point... |
|
|
|
|
and more and more people |
|
Ignored |
begin using it, |
|
again... |
|
|
|
|
|
|
|
Hmm... |
|
some other |
For example, |
|
problems may |
the greater the |
|
arise... |
volume of data |
|
|
becomes, |
the slower a |
Is it safe to trust |
In a case like this... |
|
||
a database? |
|
|
search operation |
|
|
|
|
|
may become. |
|
|
|
|
Wag, |
|
|
wag. |
Yes, indeed!
Indexing seems to be a promising solution.
Jab!
An index like one at the end of a book?
Princess...I don't really care.
Let's discuss our marriage, instead.
Indexing? |
You're right. |
|
Let's Operate a Database! 143
|
A blind search for |
|
Suppose we are going to |
the term would be |
|
painstaking, so we would |
||
find the meaning of the term |
||
check the index, instead. |
||
transaction by consulting |
||
|
||
this book on databases. |
|
Under the entry for transaction, pages that discuss transactions are listed.
transaction
transaction
Index
Reference page
|
It's just the |
By using an index, |
same for a |
we can quickly |
database index. |
find the page |
For example… |
we’re looking |
|
for! |
|
?
You're right.
144 Chapter 5
If you create indexes for Product codes,
you can instantly learn where product data is stored for a product assigned Product code 101.
101 |
Melon |
|
Data
It tells you where on the disk that product data is located.
Indexing helps speed up the search.
Shall I repeat the explanation from the start?
No,
no...
Well, it's not
so easy for me
to follow....
anyway...
It is very time consuming to browse all rows when searching for certain data.
Uh-huh.
Using indexes, we |
Reduce the disk |
can reduce the disk |
access count, and |
access count. |
our search will |
|
be much faster! |
What's |
|
that? |
|
Uh-oh. |
|
? |
|
Hey! Who are you talking to?
|
Princess, |
|
|
be careful! |
! |
Is someone |
|
|
here? |
|
Let's Operate a Database! 145
Ha, ha,
Just talking Tico ha to myself!
Oops, Raminess
can't see her.
Now, everybody,
in a standard database, I understand it is up to the database
administrator to add indexes.
There's more...?
Is that
On the other hand, right? creating too many
indexes may lead to inefficiency.
You see, it's like this. Suppose a book had an excessively large number of indexes. It would
be like putting the cart in front of the horse, wouldn’t it?
Furthermore, when updating data, you must update your indexes as well, and it would be all the more time consuming.
So is an index good or bad?
Well, that's how it works.
psst psst
Ha, ha!
So says Tico!
146 Chapter 5
I see.
The database is more clever than I thought.
Where did that rose come from?
The database...
What if the system on which the database is running goes down due to power failure?
Data
Doom
Data
It's not supposed to impress me like this! It has other problems, too!
Ack! |
For example, |
|
No problem.
Just like that.
A disaster recovery |
Disaster |
It means the |
database can |
||
function is in place. |
recovery? |
recover properly |
|
|
from trouble, if it |
|
|
occurs. |
Data
I see.
Let's Operate a Database! 147
