Name : Radhey Jivanrao Chitte.
Roll No.:15
ASSIGNMENT 3
Aim:- To Design Conceptual model using Star and Snowflake schema
Objective:- Understand the types of schemas
1. Star Schema
2. Snowflake Schema
3. And the difference between Star and Snowflake Schema.
Thoery:-
What is Schema ?
-A database schema is a logical representation of data that shows how the data in a database should be stored
logically. It shows how the data is organized and the relationship between the tables.
Basically Schema describes the structure of the table or relation.
Types of Schema:-
1.Star Schema
2.Snowflake Schema
1.Star Schema:
A star schema is the elementary form of a dimensional model, in which data are organized
into facts and dimensions. A fact is an event that is counted or measured, such as a sale or log in. A dimension
includes reference data about the fact, such as date, item, or customer. A star schema is a relational schema
where a relational schema whose design represents a multidimensional data model. The star schema is the
explicit data warehouse schema. It is known as star schema because the entity-relationship diagram of this
schemas simulates a star, with points, diverge from a central table. The center of the schema consists of a large
fact table, and the points of the star are the dimension tables.
Fact Tables
A table in a star schema which contains facts and connected to dimensions. A fact table has two types of
columns: those that include fact and those that are foreign keys to the dimension table. The primary key of the
fact tables is generally a composite key that is made up of all of its foreign keys.
Dimension Tables
A dimension is an architecture usually composed of one or more hierarchies that categorize data. If a dimension
has not got hierarchies and levels, it is called a flat dimension or list. The primary keys of each of the
dimensions table are part of the composite primary keys of the fact table. Dimensional attributes help to define
the dimensional value. They are generally descriptive, textual values. Dimensional tables are usually small in
size than fact table.
Characteristics of Star Schema:
It creates a DE-normalized database that can quickly provide query responses.
It provides a flexible design that can be changed easily or added to throughout the
development cycle, and as the database grows.
It provides a parallel in design to how end-users typically think of and use the data.
It reduces the complexity of metadata for both developers and end-users.
Example:
Suppose a star schema is composed of a fact table, SALES, and several dimension tables connected to it for
time, branch, item, and geographic locations. The TIME table has a column for each day, month, quarter, and
year. The ITEM table has columns for each item_Key, item_name, brand, type, supplier_type. The BRANCH
table has columns for each branch_key, branch_name, branch_type. The LOCATION table has columns of
geographic data, including street, city, state, and country.
We can create even more complex star schemas by normalizing a dimension table into several tables. The
normalized dimension table is called a Snowflake.
2.Snowflake Schema:
A snowflake schema is equivalent to the star schema. "A schema is known as a snowflake if one or more
dimension tables do not connect directly to the fact table but must join through other dimension tables."
The snowflake schema is an expansion of the star schema where each point of the star explodes into more
points. It is called snowflake schema because the diagram of snowflake schema resembles a
snowflake. Snowflaking is a method of normalizing the dimension tables in a STAR schemas. When we
normalize all the dimension tables entirely, the resultant structure resembles a snowflake with the fact table in
the middle.
Snowflaking is used to develop the performance of specific queries. The schema is diagramed with each fact
surrounded by its associated dimensions, and those dimensions are related to other dimensions, branching out
into a snowflake pattern.
The snowflake schema consists of one fact table which is linked to many dimension tables, which can be linked
to other dimension tables through a many-to-one relationship. Tables in a snowflake schema are generally
normalized to the third normal form. Each dimension table performs exactly one level in a hierarchy.
Example:
Figure shows a snowflake schema with a Sales fact table, with Store, Location, Time, Product, Line, and Family
dimension tables. The Market dimension has two dimension tables with Store as the primary dimension table,
and Location as the outrigger dimension table. The product dimension has three dimension tables with Product
as the primary dimension table, and the Line and Family table are the outrigger dimension tables.
Difference:
Parameters Star Schema Snowflake Schema
Definition and A star schema contains both dimension tables A snowflake schema contains all three-
meaning and fact tables in it. dimension tables, fact tables, and sub-
dimension tables.
Type of Model It is a top-down model type. It is a bottom-up model type.
Space Occupied It makes use of more allotted space. It makes use of less allotted space.
Time Taken for With the Star Schema, the process of With the Snowflake Schema, the process of
Queries execution of queries takes less time. execution of queries takes more time.
Use of The Star Schema does not make use of The Snowflake Schema makes use of both
Normalization normalization. Denormalization as well as Normalization.
Complexity of The design of a Star Schema is very simple. The designing of a Snowflake Schema is
Design very complex.
Query Complexity It is very low in the case of a Star Schema. It is comparatively much higher in the case
of a Snowflake Schema.
Complexity of It is very easy to understand a Star Schema. It is comparatively more difficult to
Understanding understand a Snowflake Schema.
Total Number of The total number of foreign keys is less in the The total number of foreign keys is more in
Foreign Keys case of a Star Schema. the case of a Snowflake Schema.
Data Redundancy Data redundancy is comparatively higher in Data redundancy is comparatively lower in
Star Schema. Snowflake Schema.
Conclusion : Star and Snowflake schemas are studied.