1 a table scan is reading every record from the table in a

Assignment Help PL-SQL Programming
Reference no: EM13380384

1. A table scan is reading every record from the table in a sequential order to find the data that a query is looking for. If you have a table with millions of records then this kind of reading can cause very slow performance in SQL queries.There are different situation where a full table scan can cause poor performance in SQL statements,such as consider a query which does not have a "Where" clause to filter the recordswhich could appear in the result set, then the full table scan will be performed on such statements or consider a query which has a"Where" clause, but none of the columns in that "Where" clause match the leading column of an index on the table, then a full table scan will be performed (Oracle, 2008) or if there is no reasonably selection condition in the "Where" clause can also cause the full table scan which in turn slows down the performance of the SQL query.

Let us consider a SQL statement which can cause the full table scan.

SQL>Select productid, prodname

2  From Product

3  Whereproddescr like '%hard disk%';

Execution Plan

----------------------------------------------------------

Plan hash value: 427209646

-----------------------------------------------------------------------------

| Id  | Operation         | Name    | Rows  | Bytes | Cost (%CPU)| Time     |

-----------------------------------------------------------------------------

|   0 | SELECT STATEMENT  |         |    22 | 44924 |     5   (0)| 00:00:01 |

|*  1 |  TABLE ACCESS FULL| PRODUCT |    22 | 44924 |     5   (0)| 00:00:01 |

-----------------------------------------------------------------------------

The above query is not very selective and could fetch millions of records on a large table by resulting the poor performance of the SQL statement. Also the "where" condition will try to match for each and every row of the "PRODUCT" table which will cause a full table scan. First of all the column specified in the where clause does not refer to index column nor it is a primary key field and a "LIKE" query with a leading wildcard cannot be optimized.

Table Joins.

a. How does the order of joins in an SQL statement affect the performance of the join?

b. What can the DBA do to determine the preferred order of joins for an SQL statement that includes the join of at least three tables?

c. Provide an example SQL join from Global Engineering or the Retail Company (but not both) and discuss the preferred join order.

Reference no: EM13380384

Questions Cloud

You have been hired as the cio of a large multinational : you have been hired as the cio of a large multinational internet advertising company. the president of the company is
Crescent manufacturing inc cmi is a luxury leader in : crescent manufacturing inc. cmi is a luxury leader in crafted and customized home furnishings. the corporate
1 not having an appropriate index can cause a full table : 1. not having an appropriate index can cause a full table scan while performing the select statement by using a
The order in which the tables in your queries are joined : the order in which the tables in your queries are joined can have an effect on the query performs. if your query is
1 a table scan is reading every record from the table in a : 1. a table scan is reading every record from the table in a sequential order to find the data that a query is looking
Within this project create a package called : within this project create a package called mycompletesystem1. author a new class within your newly created package
Learning outcomes assesseda describe and discuss the : learning outcomes assesseda describe and discuss the issues involved in managing software selection. b compare
A simple database with a single table contains data : a simple database with a single table contains data concerning rental properties in australia. the table contains five
The development of complex algorithms that can mine mounds : the development of complex algorithms that can mine mounds of data that have been collected from people and digital

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Describe what changed in the ddl for each table

Make sure that the 3 additional tables you added in Unit 3 are also shown and have established primary and foreign keys to appropriate tables.

  Calculate days between ordering and shipping

Calculate the Tax on an Order, Calculate the Total Shopper Spending - Develop a SELECT statement using the BB_SHOPPER table to produce a list of each shopper in the database and his or her respective totals.

  Sql script-creating the database and inserting data

Understanding the SQL script, creating the database and inserting data and display all product information for products that contain the string ‘saw' in their description.

  Produce a diagram showing schema

Produce a diagram showing schema and the partial and transitive dependencies in your 1NF. b. Produce a diagram showing table schema and any transitive dependencies in your 2NF

  Create a pl-sql block using the hr schema

Create a PL/SQL block to achieve the following using the HR schema and select the name, salary, and department of the employee with the maximum salary.

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Write a script that declares a variable

Write a script that declares a variable and sets it to the count of all products in the Products table. If the count is greater than or equal to 7, the script should display a message that says,

  Write a trigger and two test sql statements

Write a trigger and two test sql statements. The first statement should succeed and the second statement should fail (i.e., the second statement violates the constraint and your trigger must block it and issue an error message).

  Pretend that you are on the boards

Pretend that you are on the boards of the American National Standards Institute (ANSI) and the International Organization for Standards (ISO), two of the organizations who standardized SQL

  Pl-sql block to display last name and salary

Write a PL/SQL block that displays the last name and salary of the following people. Each of these can be done separately as PL/SQL, first to test and get the output lines then encapsulated.

  Explain entity integrity and referential integrity rules

Explain entity integrity and referential integrity rules in relational model.show how these aer realized in sql

  1 write a query to display using the employees table the

1. write a query to display using the employees table the employeeid firstname lastname and hiredate of every employee

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd