Professional Documents
Culture Documents
NAME : CHAITHRA
SRN: PES1UG20CS543
SECTION: I
(a) Load a million rows of data to a (transaction) table that should have distributed storage in
multiple drives of your PC. May use a program to create data - if used, submit the
program code.
BK =>Book table
import random
import mysql.connector
import random
import string
from decimal import Decimal
(c) The Explain/Analyze plan outputs must be part of the submission in addition to
query results.
Partitioned table – rows accessed 398138 from partition p1 which has the range between 100 and
500
The number of rows in bk table (book table) is more when compared to the partitioned table
Original table ----→518.6ms
Partitioned table-→505.68ms
Since only 3 of the 4 partitions(p1,p2,p3 were used and p0 was not used) were used the scan on
the partition table took less time when compared to the original table
3) Join query
SELECT b.ISBN, b.Title, bc.CopyID FROM bk b JOIN issue bc ON b.ISBN = bc.ISBN WHERE b.Cost <
500;
Since for this query the number of rows joined is 9 we compare the time required to join the 9
rows with cost <500 we see that the partition table takes (0.1581)lesser time to perform join
operation when compared to original table(0.2345) .
4 ) Aggregate
Only p2 and p3 partition were scanned so it took lesser time when compared to the original table
5 ) ORDER BY AND GROUP BY
Original table scan -----→5330.9 ms
Partition table scan ---→4728.4 ms
6 ) Index scan
Partitioned table with index scan took lesser time when compared to all other tables .
Hence we can come to a conclusion that partitioning the table reduces the time required to scan
table since the we scan only the required partition.