250 likes | 392 Views
Types of database. 3.3.4. The aim of this presentation. You will be able to: Explain how databases may be stored in more than one physical location and how distribution may be carried out using different approaches: Partitioned (Horizontal and Vertical) Duplicated databases
E N D
Types of database 3.3.4
The aim of this presentation • You will be able to: • Explain how databases may be stored in more than one physical location and how distribution may be carried out using different approaches: • Partitioned(Horizontal and Vertical) • Duplicated databases • Central databases with remote local indexes
Introduction • As previously mentioned, databases are the backbone of most, if not all, companies. • The wealth of information stored on a database system can sometimes be overwhelming and sometimes irrelevant to some people. • Databases can be setup in different ways and different solutions are appropriate in different situations.
What are you used to? • You are probably used to working with one database. • This database will store all the tables and all of the data. • However, there are methods which allow us to split databases into different parts and to store those parts in different physical locations. • However, a good database system will not make the user aware of this.
Partitioned databases • In a partitioned database, the database is split into different parts. • Each part is stored in a different physical ‘site’. • Each site can be on a different part of a server or on separate computers. • There are two types of partitioning: • Horizontal • Veritcal
Horizontal Partitioning • Data is partitioned based on records. • For example, an estate agency has many outlets across the country. • Instead of having one central database, the estate agency have split their database based on the agency and the location of the houses.
Horizontal Partitioning Imagine all the records for all the houses that are for sale or rent are stored in one database. Filtering houses would take longer because of the larger number of records. Also, returning results would be longer because the request has further distance to travel. Instead of saving all these records in one database you could split the records into their own database based on their locations. UK houses and flats.
Horizontal Partitioning Each branch now has its own database. If someone wanted to buy a house in their area, they would walk into their branch and the estate agent could search their database quickly. Leicester Coventry Birmingham
Horizontal Partitioning If someone wanted to move area, the estate agent would need to request data from another branch’s database. Leicester Coventry Birmingham
Vertical Partitioning • This type of partition splits data across sites based on the fields. • For example, a small chain of shops which specialises in rare, one off, products may have different departments which are in different locations. • Each shop stocks different items as most of their products are one off or bespoke. • These departments include the head office, purchasing and the actual shop.
Vertical Partitioning The head office stores information about what products are stocked in different shops. They are uninterested in the prices or who the supplier is. Head Office Purchasing Shop
Vertical Partitioning The purchasing department is interested in making orders to suppliers when they receive an order request from a shop. Head Office Purchasing Shop
Vertical Partitioning • The vendor is interested in stocking particular items and knowing: • How much stock they have • How much to sell the stock for Head Office Purchasing Shop
Vertical Partitioning All databases use this field Head Office Purchasing Shop
Replicated databases • Thinking back to our estate agency example with horizontal partitions… • Each branch had only part of all the possible records. • With replicated databases, each branch would have a complete copy of the entire database.
Replicated databases This is the full version of the database. UK houses and flats.
Replicated databases Horizontal Partition means each branch has only some of the database. UK houses and flats. Leicester Coventry Birmingham
Replicated databases Replicated databases means all branches have a full copy of the original database. UK houses and flats. Leicester Coventry Birmingham
Central database with remote local indexes • This database is stored in one place and one place only. • For example, a bank stores all the records of its customers in one database. • The problem is each branch has to search the database every time it wants to find a customer’s records.
Central database with remote local indexes • However, to speed things up, each branch keeps a database which stores the customers account number and an index number. • Now, when a branch requests data from the head office server, it can tell the server exactly where the record can be found.
Central database with remote local indexes • Think of it like a library system. • All the books are in one big room. • To find the book you were looking for you would have to search all the titles on the shelf until you found the book you wanted. • However, if you knew the index number of the book you could go straight to that section of the shelf and pick it up.
Central database with remote local indexes Head Office Leicester Branch
Example Questions • Describe how data can be distributed using horizontal partitioning. • Describe the difference between horizontal and vertical partitioning. • How could local indexes be used with a centralised database?
What’s next? • Well now you know about different ways of distributing a database… • But you still need to know when it is appropriate to use those types of database. • Read through pages 147-150 and answer the questions at the end. • Those pages are packed full of advantages and disadvantages of using different types of database.