• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/21

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

21 Cards in this Set

  • Front
  • Back
steps for using JDBC
1. establish two running programs (database server and client/application server)
2. create connectivity between the two
3. perform database query
4. process the return results
establish two running programs
database side: ensure jdbc driver installed
java side: import java.sql.*
create a connection
try{
Class.forName("org.postgresql.Driver")
}
catch(ClassNotFoundException ex){
System.out.println(ex);
}
make connection
connection con = null;
try{
con = DriverManager.getConnection(hostcomputername, user, passwd);
}
ask something for database
try{
Statement stmt = con.createStatement();
Resultset rs = stmt.executeQuery(query);
}
prepared statement
PreparedStatement ptstmt = con.prepareStatement("Insert Into T (c1, c2, c3) Values "
+ "(?, ?, ?)");
EDI
electronic data interchange
a form of electronic commerce that supports computer to computer communications
Compile steps for query
1. Lex and Parse the input
2. Compile parse-tres to abstract code
3. optimize abstract code
4. compile abstract code to physical code
5. optimize physical code
sql execution steps for query
1. Lex and Parse input
2. create a logical plan
3. optimize logical plan
4. consider, physical trade-offs, generate physical plan
three primary classes of join algorithm
1. block-nested loop
2. merge-join
3. hash-join
I/O cost of block-nested loops
(runs through the complete inner relation, S, for each chunk of R)
if S fits in M-1 buffers: B(R) + B(S)
if S does not fit: (B(S)/M-1) * (M-1 + B(R))
difference between block-nested loop and simple nested loop
for block-nested loop you dedicate most memory to the outer loop, compared to simple that ignores the availability of RAM and ignores data on disk and reads in blocks
cost of Merge-Join
B(R) + B(S)
for two phase external sorting, sorting a file f bigger than available memory requires....
2*( |f| / B) I/O reads + 2 * ( |f| /B) I/O writes
|f|: size of the file in bytes
B: number of bytes in a block
merge-sort cost with no index
5(B(R) + B(S))
affine model
f(n) = c + c'(n-1)
c: seek time for first block
c': weighted average of rotational latency + track to rack seek time for each additional block
estimating result size of selects in tuples
Result size: T(R)/V(R,A)
estimating result size of multiple selects
Result size: T(R)/(V(r, a) *(r, b) * ...)
estimating size of disjunction
T(S) = n(1 - (1 - m1/n)(1 - m2/n))
m1 tuples that satisy predicate 1
m2 tuples that satisfy predicate 2
I/O cost of Table Scan
I/O cost: c * B(R)
or c * B(R) + height of B+ tree
estimating join size results
T(R)T(S)/max(V(R,y),V(S,y))