Blog
Data Warehouse Past Paper 2016 – BSIT 7th Term UOS (IS-475)
University of Sargodha Data Ware House (IS-475) paper for BS IT 7th term, 2016 exam (80 marks, 2:30 hours). The paper has been retyped, and solved answers are given below for all 16 short questions and all five long questions, including DWH vs OLTP, ROLAP vs MOLAP, low-selective queries, ETL challenges and splitting.
Solved answers
Q1 – Short answers (16 × 2)
A. What is knowledge? Useful patterns, rules and understanding derived from data and information that help in decision making, e.g. “sales of cold drinks rise 30% in June”.
B. Crisis of credibility: When different departments produce different figures for the same question (because each extracts data from different systems at different times), managers do not trust the reports. A data warehouse with one integrated source of truth removes this problem.
C. Need of a data warehouse: To integrate data from many operational systems, keep historical data, support fast analytical queries and decision making without slowing down OLTP systems.
D. Ad-hoc access: Running unplanned queries that are not known in advance – the user asks any question at any time (e.g. “sales of product X in Sargodha last winter”). DWHs are designed for such access.
E. Knowledge worker: A person who uses information to make decisions – managers, analysts and executives who query the data warehouse.
F. “Integrated” in a data warehouse: Data from different sources is made consistent – same naming, units, codes and formats (e.g. gender M/F, 1/0 and male/female all converted to one form).
G. Hardware utilisation OLTP vs DWH: OLTP has a steady, predictable, uniform load of many small transactions. A DWH has an irregular “binary” pattern – very high utilisation while large queries/loads run and idle at other times.
H. Why does a DWH keep data of customers who have left? Because a DWH is time-variant and non-volatile: historical data is needed to analyse trends, customer churn and past performance. Deleting it would make history incomplete.
I. Is a data warehouse a complete repository of data? No. It stores only data relevant for analysis – selected, cleaned, summarised subject-oriented data – not every operational detail.
J. Why don’t we use primary keys (natural keys) in a DWH? Operational keys may change, be reused or conflict across sources. DWHs use surrogate keys (system-generated integers) for stability, history tracking (slowly changing dimensions) and faster joins.
K. How OLAP improves performance: By pre-computing aggregates and storing data in multidimensional cubes, so slice, dice, roll-up and drill-down queries are answered quickly without scanning detailed data.
L. HOLAP: Hybrid OLAP – stores detailed data in relational tables (like ROLAP) and aggregates in multidimensional cubes (like MOLAP), combining scalability with speed.
M. Parallelism: Dividing a query or task among multiple processors/disks to run simultaneously (inter-query and intra-query parallelism), reducing response time for large DWH queries.
N. Advantage of normalisation: Removes redundancy and update anomalies, saves storage and keeps data consistent.
O. Disadvantage of normalisation: Data is spread across many tables, so queries need many joins, which is slow for analytical (DWH) queries.
P. Disadvantage of denormalisation: Redundant data increases storage and the risk of inconsistency and update anomalies; loading/maintenance becomes more complex.
Q2 – Data warehousing vs OLTP
| Feature | OLTP | Data warehouse (OLAP) |
|---|---|---|
| Purpose | Run day-to-day operations | Support analysis and decision making |
| Users | Clerks, operators (many) | Managers, analysts (fewer) |
| Data | Current, detailed | Historical, summarised and detailed |
| Design | Normalised (3NF), ER model | Denormalised star/snowflake schema |
| Operations | Insert, update, delete; short transactions | Mostly read-only, complex ad-hoc queries |
| Records accessed per query | Few (tens) | Millions |
| Size | MB–GB | GB–TB and more |
| Performance metric | Transaction throughput, response in ms | Query response time in seconds/minutes |
| Volatility | Volatile (constantly updated) | Non-volatile (periodic loads) |
| Hardware usage | Steady and uniform | Irregular, peaks during queries/loads |
Example: an ATM withdrawal is OLTP; “total withdrawals per city per month over five years” is a DWH query.
Q3 – ROLAP vs MOLAP
| ROLAP (Relational OLAP) | MOLAP (Multidimensional OLAP) |
|---|---|
| Data stored in relational tables (star/snowflake schema) | Data stored in pre-computed multidimensional cubes (arrays) |
| Aggregates computed at query time with SQL | Aggregates pre-computed and stored |
| Handles very large data volumes, highly scalable | Limited by cube size; “cube explosion” with many dimensions |
| Slower query response | Very fast slice/dice/drill-down |
| Uses existing RDBMS skills and tools | Needs special MOLAP engine |
| Handles sparse data well | Sparse data wastes space (needs compression) |
| Examples: Oracle, MicroStrategy | Examples: Essbase, SSAS cubes |
HOLAP combines both: detail in relational tables and summaries in cubes.
Q4 – Low-selective queries
Selectivity is the fraction of rows a query returns. A low-selective query qualifies a large percentage of rows of a table (e.g. 20–50% or more). Indexes do not help such queries because reading through an index would touch most blocks anyway; a full table scan with parallelism, partitioning or pre-aggregation is faster. Data warehouses commonly face such queries.
- Example 1:
SELECT region, SUM(amount) FROM sales WHERE gender = 'F' GROUP BY region;– about half of all rows qualify. - Example 2:
SELECT COUNT(*) FROM customers WHERE age > 18;– most customers satisfy the condition.
In contrast, a highly selective query such as WHERE cnic = '35202-…' returns one row and benefits from a B-tree index. For low-selective columns, bitmap indexes or partitioning are used.
Q5 – Challenges of ETL
ETL (Extract, Transform, Load) moves data from source systems into the warehouse and usually takes 60–80% of DWH project effort.
- Diverse sources: different DBMSs, files, legacy systems, formats and platforms must be accessed.
- Data quality: missing values, duplicates, wrong spellings, invalid dates and inconsistent codes (M/F vs 1/0) must be cleaned.
- Semantic heterogeneity: same name with different meaning or different names for the same thing; unit and currency conversions.
- Identifying changes: capturing only new/changed data (change data capture) for incremental loads; handling slowly changing dimensions.
- Volume and load window: huge data must be loaded within a limited nightly window without disturbing OLTP systems.
- Surrogate key generation and referential integrity between facts and dimensions.
- Error handling and recovery: restarting failed loads, logging and audit trails.
- Changing requirements and source systems, and lack of documentation of legacy data.
These are addressed with ETL tools, staging areas, data profiling, cleansing rules and careful scheduling.
Q6 – When splitting causes performance loss
Horizontal splitting divides a table by rows (e.g. sales_2015, sales_2016, or by region); vertical splitting divides it by columns (frequently used columns in one table, rarely used ones in another, joined by the key). Splitting helps when queries use only one part, but it can hurt performance:
- Horizontal example: the sales table is split by year. A query “total sales of product P for the last five years” must now access five tables and combine them with UNION; with an index on each piece, five separate index searches are needed – slower than one scan of a single partitioned table.
- Horizontal example 2: splitting by region when most queries are by product – every query touches all pieces.
- Vertical example: the customer table is split into Customer_A (id, name, city) and Customer_B (id, income, occupation). A query “customers in Lahore with income > 100,000” needs columns from both parts, so an extra join on id is required for every row, increasing I/O and CPU time.
Therefore splitting should follow the actual query patterns; otherwise the extra unions and joins cause performance loss.
