Indexing  Consider a relational database that consists of the relational tables created by the following CREATE TABLE statements: CREATE TABLE PART(  P_PARTKEY NUMBER(12) NOT NULL,  P_NAME VARCHAR(55) NOT NULL,  P_RETAILPRICE NUMBER(12,2) NOT NULL,  CONSTRAINT PART_PEKEY PRIMARY KEY (P_PARTKEY) );    CREATE TABLE SUPPLIER( S_SUPPKEY NUMBER(12) NOT NULL,  S_NAME CHAR(25) NOT NULL  S_NATIONKEY NUMBER(12) NOT NULL,  S_PHONE CHAR(15) NOT NULL, CONSTRAINT SUPPLIER_PKEY PRIMARY KEY (S_SUPPKEY) );   CREATE TABLE PARTSUPP(  PS_PARTKEY NUMBER(12) NOT NULL, PS_SUPPKEY NUMBER(12) NOT NULL, PS_SUPPLYCOST NUMBER(12,2) NOT NULL, CONSTRAINT PARTSUPP_PKEY PRIMARY KEY (PS_PARTKEY, PS_SUPPKEY), CONSTRAINT PARTSUPP_FKEY1 FOREIGN KEY (PS_PARTKEY) REFERENCES PART(P_PARTKEY),  CONSTRAINT PARTSUPP_FKEY2 FOREIGN KEY (PS_SUPPKEY) REFERENCES SUPPLIER(S_SUPPKEY) );   Determine what index should be created to improve the performance of the queries listed below in the best possible way. Consider each one of the queries as an individual case. If you decide that an index should be created, then list the names of attributes that form an index key. Remember that the order of attributes in an index key is important. If you decide not to create an index explain why the performance will not suffer when a new index is not available. Assume that all relational tables are large enough to make full tables scan more time consuming that accessing the tables through an index.    i) SELECT * FROM PART WHERE P_NAME = 'MOTHER-BOARD' AND P_RETAILPRICE = 250; ii) SELECT COUNT(*) FROM PART WHERE P_NAME= 'COOLING-FAN'; iii) SELECT PS_SUPPKEY FROM PARTSUPP WHERE PS_PARTKEY = 'MOTHER-BOARD'; v) SELECT S_NAME FROM SUPPLIER; vi) SELECT PS_PARKEY,COUNT(*) FROM PARTSUPP GROUP BY PS_PARTKEY HAVING COUNT(*) >3;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Indexing 

Consider a relational database that consists of the relational tables created by the following CREATE TABLE statements:

CREATE TABLE PART(

 P_PARTKEY NUMBER(12) NOT NULL,

 P_NAME VARCHAR(55) NOT NULL,

 P_RETAILPRICE NUMBER(12,2) NOT NULL,

 CONSTRAINT PART_PEKEY PRIMARY KEY (P_PARTKEY) ); 

 

CREATE TABLE SUPPLIER(

S_SUPPKEY NUMBER(12) NOT NULL, 

S_NAME CHAR(25) NOT NULL 

S_NATIONKEY NUMBER(12) NOT NULL, 

S_PHONE CHAR(15) NOT NULL,

CONSTRAINT SUPPLIER_PKEY PRIMARY KEY (S_SUPPKEY) );

 

CREATE TABLE PARTSUPP( 

PS_PARTKEY NUMBER(12) NOT NULL,

PS_SUPPKEY NUMBER(12) NOT NULL,

PS_SUPPLYCOST NUMBER(12,2) NOT NULL,

CONSTRAINT PARTSUPP_PKEY PRIMARY KEY (PS_PARTKEY, PS_SUPPKEY), CONSTRAINT PARTSUPP_FKEY1 FOREIGN KEY (PS_PARTKEY) REFERENCES PART(P_PARTKEY), 

CONSTRAINT PARTSUPP_FKEY2 FOREIGN KEY (PS_SUPPKEY) REFERENCES SUPPLIER(S_SUPPKEY) );

 

Determine what index should be created to improve the performance of the queries listed below in the best possible way. Consider each one of the queries as an individual case. If you decide that an index should be created, then list the names of attributes that form an index key. Remember that the order of attributes in an index key is important. If you decide not to create an index explain why the performance will not suffer when a new index is not available. Assume that all relational tables are large enough to make full tables scan more time consuming that accessing the tables through an index. 

 

i) SELECT * FROM PART WHERE P_NAME = 'MOTHER-BOARD' AND P_RETAILPRICE = 250;

ii) SELECT COUNT(*) FROM PART WHERE P_NAME= 'COOLING-FAN';

iii) SELECT PS_SUPPKEY FROM PARTSUPP WHERE PS_PARTKEY = 'MOTHER-BOARD';

v) SELECT S_NAME FROM SUPPLIER;

vi) SELECT PS_PARKEY,COUNT(*) FROM PARTSUPP GROUP BY PS_PARTKEY HAVING COUNT(*) >3;

 

 

Subject: MySQL

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education