Download presentation
Presentation is loading. Please wait.
1
Some TPC-H queries on Teradata and PostgreSQL
Project Partners: Amreek Singh ( ) Chetan Vaity ( )
2
Motivation Usage of real Database Systems
Gain some experience in database tuning Work with Teradata machine in SIT Test Setup Twin processors with 2GB RAM, proprietary parallel storage system Windows 2000 Advanced Server Teradata v4.1.2 Twin Xeon processors with 2GB RAM, RAID 5 Linux Kernel version smp PostgreSQL v7.2.1
3
TPC-H Schema A typical manufacturing concern database
Part (200K rows) Order (1500K rows) Partsupp (800K rows) Lineitem (6000K rows) Supplier (10K rows) Customer (150K rows) Nation (24 rows) Region (5 rows) A typical manufacturing concern database Approximately 1GB of data
4
TPC-H Query 2 Teradata Query Plan Region Nation
SELECT s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment FROM part, supplier, partsupp, nation, region WHERE p_partkey = ps_partkey AND s_suppkey = ps_suppkey AND p_size = 15 AND p_type like '%BRASS' AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 'EUROPE' AND ps_supplycost = ( min(ps_supplycost) partsupp, supplier, nation, region ) ORDER BY s_acctbal desc, n_name, s_name, p_partkey; Region Nation Region (r_name=‘EUROPE’) Part Part (p_size=15) (p_type=‘%BRASS’) Partsupp Supplier Teradata Query Plan
5
Analysis of query execution plans of both systems
Added indexes (B-Tree indexes on all) Rewrote the query using “explicit join” clause Reduced query time from 40 minutes to 2 seconds Region Nation Region (r_name=‘EUROPE’) Part Part (p_size=15) (p_type=‘%BRASS’) Partsupp Supplier PostgreSQL Query Plan
6
Query execution times Teradata t1 t2 t3 PostgreSQL Initial
31 sec 25 sec 26 sec Q2 11 sec 10 sec 1 sec Q3 2 min 15sec 2 min 11 sec 1 min 16 sec After adding secondary index on n_nationkey on supplier table After Collect statistics PostgreSQL Initial After “ANALYZE” After adding indexes Q6 33 sec 32 sec 30 sec Q2 40 m 19 sec 35 min 4 sec 2 sec Q3 11 min 43 sec 11 min 32 sec 1 min 11 sec
7
Conclusion: Bibliography
Query plans are very useful in database tuning Parallel architecture under full DBMS control performs Bibliography PostgreSQL Documentation Teradata Documentation Database Tuning, Dennis Shasha
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.