This repository was archived by the owner on Mar 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
820 lines (774 loc) · 29.6 KB
/
index.html
File metadata and controls
820 lines (774 loc) · 29.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
<!doctype html>
<!--
Welcome to the light side of the source, young padawan.
One step closer to learn something interesting you are...
____
_.' : `._
.-.'`. ; .'`.-.
__ / : ___\ ; /___ ; \ __
,'_ ""=-.:__;".-.";: :".-.":__;.-="" _`,
:' `.t""=-.. '<@.`;_ ',@:` ..-=""j.' `;
`:-.._J '-.-'L__ `-.-' L_..-;'
"-.__ ; .-" "-. : __.-"
L ' /.======.\ ' J
"-. "__" .-"
__.l"-:_JL_;-";.__
.-j/'.; ;"""" / .'\"-.
.' /:`. "-.: .-" .'; `.
.-" / ; "-. "-..-" .-" : "-.
.+"-. : : "-.__.-" ;-._ \
; \ `.; ; : : "+. ;
: ; ; ; : ; : \:
; : ; : ;: ; :
: \ ; : ; : ; / ::
; ; : ; : ; : ;:
: : ; : ; : : ; : ;
;\ : ; : ; ; ; ;
: `."-; : ; : ; / ;
; -: ; : ; : .-" :
:\ \ : ; : \.-" :
;`. \ ; : ;.'_..-= / ;
: "-. "-: ; :/." .' :
\ \ : ;/ __ :
\ .-`.\ /t-"" ":-+. :
`. .-" `l __/ /`. : ; ; \ ;
\ .-" .-"-.-" .' .'j \ / ;/
\ / .-" /. .'.' ;_:' ;
:-""-.`./-.' / `.___.'
\ `t ._ /
"-.t-._:'
-->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- https://www.freepik.com from www.flaticon.com -->
<link rel="icon" type="image/png" href="./resources/images/favicon.png"/>
<title>Datenbanken II - Implementierung - Vorlesung 6</title>
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/black.css" id="theme">
<!-- Theme used for syntax highlighted code -->
<link rel="stylesheet" href="plugin/highlight/monokai.css" id="highlight-theme">
<!-- Chalkboard -->
<link rel="stylesheet" href="./plugin/chalkboard/style.css">
<link rel="stylesheet" href="./plugin/customcontrols/style.css">
<!-- Font awesome -->
<link rel="stylesheet" href="./plugin/menu/font-awesome/css/fontawesome.css">
<!-- Bootstrap-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</head>
<body>
<div class="scriptsVARIABLES">
<script>
let erklaerFolie = false;
let icons = true;
let nicoIcon = "🦙"; // 🦙
let dannyIcon = "🐺"; // 🐺
let georgIcon = "💪"; // 💪
let denisIcon = "💻"; // 💻
</script>
</div>
<div class="reveal">
<!-- Footer && <Header -->
<style>
.reveal .footer {
position: absolute;
top: 1em;
right: 1em;
font-size: 0.5em;
line-height: 23px;
}
.header{
position: absolute;
top: 1em;
right : 1em;
}
.troll{
position: absolute;
top: 10px;
right : 10px;
font-size: 12px;
}
.persons{
position: absolute;
top: 20px;
left : 15px;
}
h1,h2,h3,h4,h5,h6{
padding-top: 2%;
}
.li__main--topic,.li__main--topic-header{
color: #e74c3c;
font-weight: bold;
}
.li__sub--topic,.li__main--topic-sub-header{
color: darkorange;
font-weight: bold;
}
.li__sub__sub--topic,.li__main--topic-sub-sub-header{
color: lightskyblue;
font-weight: bold;
}
.caption {
color: gray;
font-size: 13pt;
margin-top: 20pt;
}
.row {
display: flex;
}
/* Create two equal columns that sits next to each other */
.column {
flex: 50%;
padding: 10px;
height: 300px; /* Should be removed. Only for demonstration */
}
</style>
<div class='footer'>
🎓 DB II - Implementierungen <br>
📅 22.11.2021 <br>
👤 Danny Kroll, Nico Holzhäuser, <br>
<span style="padding-left:29px"></span>Denis Thiessen & Georg Reichert
</div>
<script type="text/javascript">
if (erklaerFolie || icons){
document.write('<div id="persons" class="persons">' + nicoIcon + '</div>');
}
</script>
<!-- Slides -->
<div class="slides" id="organisatorisches">
<!-- Introduction -->
<section>
<h2>Willkommen zu unserer <br> Präsentation über</h2> <br>
<a><b>Programmier- und sonstige Schnittstellen & <br> Optimierung von Anfragen</b></a> <br>
<em>Vorlesung 6</em>
<br> <br>
Shortlink der Präsentation <br> <a href="https://s.p4ddy.com/db2suo">https://s.p4ddy.com/db2suo</a>
</section>
<!-- Dividing -->
<script type="text/javascript">
if (erklaerFolie == 1) {
document.write(
'<section>\n' +
'<h3>Sprecher</h3>\n' +
'<p>' +
'↖ Jedes Symbol steht für einen anderen Sprecher\n' +
'<ul style="list-style-type: none">' +
'<li>' + denisIcon + '→ Denis Thiessen</li>' +
'<li>' + nicoIcon + '→ Nico Holzhäuser</li>' +
'<li>' + dannyIcon + '→ Danny Kroll</li>' +
'<li>' + georgIcon + '→ Georg Reichert</li>' +
'</ul>' +
'</p>' +
'</section>');
}
</script>
<!-- <section>
<h3>Sprecher</h3>
<p>
↖ Jedes Symbol steht für einen anderen Sprecher
<ul style="list-style-type: none">
<li><script>document.write(denisIcon)</script> → Denis Thiessen</li>
<li><script>document.write(nicoIcon)</script> → Nico Holzhäuser</li>
<li><script>document.write(dannyIcon)</script> → Danny Kroll</li>
<li><script>document.write(georgIcon)</script> → Georg Reichert</li>
</ul>
</p>
</section> -->
<!-- ToC -->
<section>
<h2 style="padding-top: 1%">Inhalt</h2>
<ol type="1" style="font-size:50%;">
<li class="li__main--topic">Schnittstellen</li>
<ol>
<li class="li__sub--topic">Datenbankschnittstellen</li>
<ol>
<li class="li__sub__sub--topic">SQL Command Line</li>
<li class="li__sub__sub--topic">DB spezifische SQL - Schnittstellen</li>
<li class="li__sub__sub--topic">PL/SQL</li>
</ol>
<li class="li__sub--topic">Programmierschnittstellen</li>
<ol>
<li class="li__sub__sub--topic">Embedded SQL</li>
<li class="li__sub__sub--topic">Call-Level-Interface</li>
</ol>
</ol>
<li class="li__main--topic">Optimierung von Abfragen</li>
<ol>
<li class="li__sub--topic">Grundprinzip der Optimierung</li>
<ol>
<li class="li__sub__sub--topic">Logische Optimierung</li>
<li class="li__sub__sub--topic">Physische Optimierung</li>
<li class="li__sub__sub--topic">Kostenbasierte Auswahl</li>
</ol>
<li class="li__sub--topic">Phasen der Optimierung</li>
<ol>
<li class="li__sub__sub--topic">Anfrageübersetzung und -vereinfachung</li>
<li class="li__sub__sub--topic">Logische Optimierung</li>
<li class="li__sub__sub--topic">Physische Optimierung</li>
<li class="li__sub__sub--topic">Kostenbasierte Auswahl</li>
<li class="li__sub__sub--topic">Planparametrisierung</li>
<li class="li__sub__sub--topic">Codeerzeugung</li>
</ol>
</ol>
</ol>
</section>
</div>
<!--
_______ ______ __________________ _______ _______
( ____ \( __ \ \__ __/\__ __/ ( )( ____ \
| ( \/| ( \ ) ) ( ) ( | () () || ( \/
| (__ | | ) | | | | | | || || || (__
| __) | | | | | | | | | |(_)| || __)
| ( | | ) | | | | | | | | || (
| (____/\| (__/ )___) (___ | | | ) ( || (____/\
(_______/(______/ \_______/ )_( |/ \|(_______/
-->
<div class="slides" id="Schnittstellen">
<section>
<h1 style="color: #e74c3c;">Schnittstellen</h1>
</section>
<section>
<section>
<h2 style="color: darkorange;">Datenbankschnittstellen</h2>
</section>
<!-- SQL Command Line-->
<section>
<h3 style="color: lightskyblue;">SQL Command Line</h3>
<p class="caption">
<img src="./resources/images/6_sql_cli.png"
style="width: 40%">
<br> Source : Matthias Goettler @DHBW Karlsruhe -- Datenbanken II-Implementierung -- Modul 4 – Programmier- und sonstige Schnittstellen</a>
</p>
</section>
<!-- DB spezifische SQL - Schnittstellen -->
<section>
<h3 style="color: lightskyblue;">DB spezifische SQL - Schnittstellen</h3>
<!-- https://learnsql.com/blog/what-sql-dialect-to-learn/ -->
<ul>
<li class="fragment" data-fragment-index="1">T-SQL - vom Sybase und Microsoft</li>
<span class="fragment highlight-current-red" data-fragment-index="4">
<li class="fragment" data-fragment-index="2">PL/SQL - Oracle</li>
<ul>
<li class="fragment">besteht aus <b style="color: red">U</b>ser<b style="color: red">D</b>efined<b style="color: red">F</b>unctions und <br>
<b style="color: red">U</b>ser-defined <b style="color: red">S</b>tored<b style="color: red">P</b>rocess</li>
</ul>
</span>
</ul>
</section>
<!-- Stored Procedures-->
<!-- https://en.wikipedia.org/wiki/User-defined_function -->
<section>
<h3 style="color: lightskyblue;">PL/SQL - User-Defined Functions (UDF)</h3>
<ul>
<li class="fragment">Erweitert den Funktionsumfang des Datenbankservers
<pre>
<code data-trim>
CREATE FUNCTION dbo.CtoF(Celsius FLOAT)
RETURNS FLOAT
RETURN (Celsius * 1.8) + 32
</code>
</pre>
</li>
<li class="fragment">Wird in einerm normalen SQL Anweisung evaluiert
<pre>
<code data-trim>
SELECT Name, CtoF(BoilingPoint)
FROM Elements
</code>
</pre>
</li>
</ul>
</section>
<!-- Stored Procedures-->
<section>
<h3 style="color: lightskyblue;">PL/SQL - User-Defined Stored Procedures (USP)</h3>
<ul>
<li>Sammlung von wiederkehrenden SQL Anweisungen zusammengefasst in einer Prozedur</li>
<li>Ausführung auf dem DB Server – nicht auf dem Client</li>
<ul>
<li>=> Extrem schnell</li>
</ul>
</ul>
</section>
<!-- http://www.dbarepublic.com/2016/04/oracle-stored-procedure-with-examples.html -->
<section>
<h3 style="color: lightskyblue;">PL/SQL - User-Defined Stored Procedures (USP)</h3>
<pre>
<code data-trim class="language-sql" data-line-numbers="1-3|4-5|6-7|8-9|10">
CREATE [OR REPLACE] PROCEDURE procedure_name [(
parameter [,
parameter]) ]
IS
[VARIABLE declaration goes here]
BEGIN
[Executable SQL statements goes here]
EXCEPTION
[Error handling goes here]
END [procedure_name];
</code>
</pre>
</section>
<section>
<h3 style="color: lightskyblue;">PL/SQL - User-Defined Stored Procedures (USP)</h3>
<pre style="height: 675px">
<code data-trim class="language-sql" data-line-numbers="1-4|5-8|9-18|19-23|24">
CREATE OR REPLACE PROCEDURE insert_employee(
empno_in IN NUMBER,
ename_in IN VARCHAR2,
job_in IN VARCHAR2,
-– Just the data type, don’t define the data length
IS
ecode NUMBER;
emesg VARCHAR2(200);
BEGIN
INSERT INTO baniya.emp(
empno,
ename,
job)
VALUES(
empno_in,
ename_in,
job_in);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ecode := SQLCODE;
emesg := SQLERRM;
dbms_output.put_line(TO_CHAR(ecode) || '-' || emesg);
END insert_employee;
</code>
</pre>
</section>
<section>
<h3 style="color: lightskyblue;">PL/SQL - User-Defined Stored Procedures (USP)</h3>
<pre>
<code data-trim class="language-sql" data-line-numbers="1-4|5-7|8">
declare
empno_in NUMBER := 1234;
ename_in VARCHAR2(20) := 'SCHEMID';
job_in VARCHAR2(50) := 'VP';
begin
baniya.insert_employee(empno_in, ename_in,
job_in);
end;
</code>
</pre>
<p class="caption fragment">
<img src="https://3.bp.blogspot.com/-_mFxzEKsw0I/Vw29piZfAxI/AAAAAAAAIa4/Z4Hb14I9WtUEa7B4PB5764_6qvowbzKCwCLcB/s1600/dbarepublic_sp_1.png"
style="width: 40%">
<br> Source : <a href="http://www.dbarepublic.com/2016/04/oracle-stored-procedure-with-examples.html">http://www.dbarepublic.com/2016/04/oracle-stored-procedure-with-examples.html</a>
</p>
</section>
</section>
<section>
<section>
<h2 style="color: darkorange;">Programmierschnittstellen</h2>
</section>
<section>
<h2 style="color: darkorange;">Programmierschnittstellen</h2>
<p class="caption">
<img src="./resources/images/Hierachie.png"
style="width: 60%">
<br> Source : Matthias Goettler @DHBW Karlsruhe -- Datenbanken II-Implementierung -- Modul 4 – Programmier- und sonstige Schnittstellen</a>
</p>
</section>
<section>
<h2 style="color: lightskyblue;">Embedded SQL</h2>
<!-- https://en.wikipedia.org/wiki/SQLJ -->
<a>am Beispiel einer Single Row Query</a>
<div class="row">
<div class="column">
<h3>JDBC</h3>
<pre>
<code data-trim class="language-java">
PreparedStatement stmt = conn.prepareStatement(
"SELECT MAX(SALARY), AVG(SALARY)"
+ " FROM DSN8710.EMP");
rs = stmt.executeQuery();
if (!rs.next()) {
// Error—no rows found
}
maxSalary = rs.getBigDecimal(1);
avgSalary = rs.getBigDecimal(2);
if (rs.next()) {
// Error—more than one row found
}
rs.close();
stmt.close();
</code>
</pre>
</div>
<div class="column">
<h3>SQLJ</h3>
<pre>
<code data-trim class="language-java">
#sql [ctx] {
SELECT MAX(SALARY), AVG(SALARY)
INTO :maxSalary, :avgSalary
FROM DSN8710.EMP
};
</code>
</pre>
</div>
</div>
</section>
<section>
<h2 style="color: lightskyblue;">Embedded SQL</h2>
<div class="row">
<div class="column" style="color: green">
<h3 style="color: green">Vorteile</h3>
<ul>
<li>SQLJ Befehle sind oft kürzer als gleichwertige JDBC Implementierungen</li>
<li class="fragment">Die SQL Syntax wird beim Compilen bereits überprüft</li>
<li class="fragment">Ergebnissets können strikt überprüft werden</li>
<li class="fragment">Performancevorteile gegenüber dynamischem SQL</li>
</ul>
</div>
<div class="column">
<h3 style="color: darkred">Nachteile</h3>
<ul style="color: darkred">
<li class="fragment">SQLJ benötigt einen zusätzlichen Schritt (Preprocessing)</li>
<li class="fragment">Viele IDEs haben keinen SQLJ Support</li>
<li class="fragment">keine Unterstützung in vielen Persistenz-Frameworks (z.B. Hibernate)</li>
<li class="fragment">Oracle 18c (12.2) hat SQLJ in der Datenbank nicht unterstützt. </li>
</ul>
</div>
</div>
</section>
<section>
<h2 style="color: lightskyblue;">Call-Level-Interface (Dynamic SQL)</h2>
</section>
<!-- ODBC -->
<section>
<h2 style="color: lightskyblue;">Call-Level-Interface (Dynamic SQL)</h2>
<h3 style="color: purple;">Proprietäre CLIs</h3>
<ul>
<li >Viele DBMS Hersteller bieten eigene CLIs an, die spezifische DB Features unterstützen</li>
<li class="fragment" data-fragment-index="2">Bekanntes Beispiele</li>
<ul class="fragment" data-fragment-index="2">
<li>Teradata CLIv2</li>
<li>IBM Db2®</li>
</ul>
</ul>
</section>
<!-- ODBC -->
<section>
<!-- https://www.datenbanken-verstehen.de/lexikon/odbc/ -->
<h2 style="color: lightskyblue;">Call-Level-Interface (Dynamic SQL)</h2>
<h3 style="color: purple;"><b>O</b>pen <b>D</b>ata<b>B</b>ase <b>C</b>onnectivity</h3>
<ul>
<li class="fragment"><b style="color: red">O</b>pen <b style="color: red">D</b>ata<b style="color: red">B</b>ase <b style="color: red">C</b>onnectivity beschreibt eine standardiesierte Datenbankschnittstelle</li>
<li class="fragment">ODBC stellt Programmierern eine Programmierschnittstelle auf eine Datenbank zur Verfügung</li>
<li class="fragment">ODBC ist plattform- und sprachunabhängig</li>
<li class="fragment">ODBC Code ist oft Komplex und wird heute z.B. in Java kaum verwendet</li>
</ul>
</section>
<!-- JDBC -->
<!-- https://gadget-info.com/difference-between-jdbc -->
<section>
<h2 style="color: lightskyblue;">Call-Level-Interface (Dynamic SQL)</h2>
<h3 style="color: purple;"><b>J</b>ava <b>D</b>ata<b>B</b>ase <b>C</b>onnectivity</h3>
<ul>
<li class="fragment">Ist seit 1996 ein Teil des JDK</li>
<li class="fragment">JDBC gibt Programmierern in <b>in JAVA</b> eine Möglichkeit zur Datenbankverbindung</li>
<li class="fragment">JDBC Code ist leicht verständlich</li>
</ul>
</section>
<section>
<h2 style="color: lightskyblue;">Call-Level-Interface (Dynamic SQL)</h2>
<h3 style="color: purple;">Beispiel eines <b>J</b>ava <b>D</b>ata<b>B</b>ase <b>C</b>onnectivity Connectors in Java</h3>
<pre style="height: 565px">
<code data-trim class="language-java" data-line-numbers="2-5|7|8|9|10-15">
public class FirstExample {
static final String DB_URL = "jdbc:mysql://localhost/TUTORIALSPOINT";
static final String USER = "guest";
static final String PASS = "guest123";
static final String QUERY = "SELECT id, first, last, age FROM Employees";
public static void main(String[] args) {
try(Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(QUERY);) {
while (rs.next()) {
System.out.print("ID: " + rs.getInt("id"));
System.out.print(", Age: " + rs.getInt("age"));
System.out.print(", First: " + rs.getString("first"));
System.out.println(", Last: " + rs.getString("last"));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
</code>
</pre>
</section>
<section>
<h2 style="color: lightskyblue;">Call-Level-Interface (Dynamic SQL)</h2>
<h3 style="color: purple;">Unterschied ODBC ⚡ JDBC</h3>
<p class="caption">
<img src="./resources/images/jdbc.jpg"
style="width: 50%">
<br> Source : <a href="https://apcpedagogie.com/le-pilote-jdbc/">https://apcpedagogie.com/le-pilote-jdbc/</a>
</p>
</section>
<section>
<h2 style="color: lightskyblue;">Call-Level-Interface (Dynamic SQL)</h2>
<h3 style="color: purple;">Unterschied ODBC ⚡ JDBC</h3>
<table style="width: 80%">
<tbody>
<tr>
<th>Vergleichsgrundlage</th>
<th>JDBC</th>
<th>ODBC</th>
</tr>
</tbody>
<tbody>
<tr>
<td>Basic</td>
<td>JDBC ist <b>Java-spezifisch</b> sprach- und plattformabhängig!</td>
<td>ODBC ist sprach- und plattformunabhängig.</td>
</tr>
<tr class="fragment">
<td>Funktion</td>
<td>Java-Datenbankverbindung.</td>
<td>Öffnen Sie die Datenbankverbindung.</td>
</tr>
<tr class="fragment">
<td>Code</td>
<td>Code ist leicht zu verstehen.</td>
<td>Code ist komplex.</td>
</tr>
</tbody>
</table>
</section>
</section>
</div>
<div class="slides" id="Optimierung von Abfragen">
<section>
<h1 style="color: #e74c3c;">Optimierung von Abfragen</h1>
</section>
<section>
<section>
<h2 style="color: darkorange;">Grundprinzip der Optimierung</h2>
</section>
<section>
<h2 style="color: darkorange;">Grundprinzip der Optimierung</h2>
Ziel ist eine möglichst schnelle Anfragebearbeitung, um möglichst wenige Seitenzugriffe bei der Anfragebearbeitung durchzuführen.
</section>
<section>
<h3 style="color: lightskyblue;">Logische Optimierung</h3>
<ul>
<li>Umformung der übersetzten Anfrage als Relationenalgebra Term</li>
<li>Anfrageterm wird umgeformt. (Durch Selektionenverschiebung nach innen z.B.)</li>
</ul>
<div class="row">
<div class="column">
<h3>Vorher</h3>
<pre>
<code data-trim class="language-sql">
SELECT s.SalesRep, o.Amount
FROM Customers
WHERE Sales > 50000
</code>
</pre>
</div>
<div class="column">
<h3>Nachher</h3> <br>
σ <sub>sales</sub> > 50000 (Customers)
</div>
</div>
</section>
<section>
<h3 style="color: lightskyblue;">Physische Optimierung</h3>
<ul>
<li>Erzeugung eines oder mehrerer Zugriffspläne aus dem umgeformten Ausdruck</li>
<li>Ersetzen von abstrakten Algebraoperationen durch konkrete Algorithmen</li>
<li>Benötigt allerdings Information über vorliegende Indexstrukturen</li>
</ul>
</section>
<section>
<h3 style="color: lightskyblue;">Kostenbasierte Auswahl</h3>
<ul>
<li>Auswahl aus mehreren Plänen</li>
<li>Basierend auf statistischen Informationen</li>
<li>Diese statistischen Informationen werden im System gespeichert</li>
</ul>
</section>
</section>
<section>
<section>
<h2 style="color: darkorange;">Phasen der Optimierung</h2>
</section>
<section>
<h2 style="color: darkorange;">Phasen der Optimierung</h2>
<ul>
<li>Anfrageübersetzung und -vereinfachung</li>
<li>Logische Optimierung</li>
<li>Physische Optimierung</li>
<li>Kostenbasierte Optimierung</li>
<li>Planparametrisierung</li>
<li>Codeerzeugung</li>
</ul>
</section>
<section>
<h3 style="color: lightskyblue;">Anfrageübersetzung und -vereinfachung</h3>
Umschreiben der Anfrage und darin enthaltenen Strukturen zur Verminderung der Komplexität.<br>
Beispiel: SELECT-Statement mit WHERE-Clause zu einem JOIN.
<div class="row">
<div class="column">
<h3>WHERE</h3>
<pre>
<code data-trim class="language-sql">
SELECT s.SalesRep, o.Amount
FROM SalesRep s, Orders o
WHERE s.id = o.id
</code>
</pre>
</div>
<div class="column">
<h3>JOIN</h3>
<pre>
<code data-trim class="language-sql">
SELECT s.SalesRep, o.Amount
FROM SalesRep s
INNER JOIN Orders o ON s.id = o.id
</code>
</pre>
</div>
</div>
</section>
<section>
<h2>Bereits in <a style="color: darkorange;">Sektion 2.1</a> behandelt</h2>
<ul>
<li style="color: lightskyblue;">Logische Optimierung</li>
<li style="color: lightskyblue;">Physische Optimierung</li>
<li style="color: lightskyblue;">Kostenbasierte Auswahl</li>
</ul>
</section>
<section>
<h3 style="color: lightskyblue;">Planparametrisierung</h3>
Bei vorkompilierten SQL-Anweisungen können Optimierungsschritte weggelassen werden, da Ausführungspläne bereits existieren.<br>
-> Nur Platzhalter in Anfrage parametrisieren mit übergebenen Werten.
</section>
<section>
<h3 style="color: lightskyblue;">Codeerzeugung</h3>
Zugriffsplan wandelt schließlich Anfrage in Ausführbaren Code um.<br>(Oder direkt vom Interpreter verarbeitet...)
</section>
</section>
</div>
<div class="slides" id="endslide">
<section>
<h1>Vielen Dank für eure <br> Aufmerksamkeit!</h1>
<br>
<p>Schaut auch gerne in unseren <a target="_blank" href="https://github.com/Unk3wn/Datenbanken_II_Implementierung">Presentation - Code</a> und <a target="_blank" href="https://revealjs.com/">reveal.js</a></p>
<br>
<p><a href="./index.html?print-pdf">Präsentation drucken</a></p>
</section>
</div>
<!-- NO CHANGING AFTER HERE -->
</div>
<div id="scripts">
<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<!-- Chalkboard -->
<script src="plugin/chalkboard/plugin.js"></script>
<script src="plugin/customcontrols/plugin.js"></script>
<script src="plugin/menu/menu.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
showNotes: "true",
controls: true,
progress: true,
history: true,
center: true,
mouseWheel: true,
menu: { // Menu works best with font-awesome installed: sudo apt-get install fonts-font-awesome
side:'left',
themes: false,
transitions: false,
markers: false,
hideMissingTitles: true
},
chalkboard: {
boardmarkerWidth: 3,
chalkWidth: 7,
chalkEffect: 1.0,
storage: null,
src: null,
readOnly: undefined,
transition: 800,
theme: "chalkboard",
background: [ 'rgba(127,127,127,.1)' , path + 'img/blackboard.png' ],
grid: { color: 'rgb(50,50,10,0.5)', distance: 80, width: 2},
eraser: { src: path + 'img/sponge.png', radius: 20},
boardmarkers : [
{ color: 'rgba(100,100,100,1)', cursor: 'url(' + path + 'img/boardmarker-black.png), auto'},
{ color: 'rgba(30,144,255, 1)', cursor: 'url(' + path + 'img/boardmarker-blue.png), auto'},
{ color: 'rgba(220,20,60,1)', cursor: 'url(' + path + 'img/boardmarker-red.png), auto'},
{ color: 'rgba(50,205,50,1)', cursor: 'url(' + path + 'img/boardmarker-green.png), auto'},
{ color: 'rgba(255,140,0,1)', cursor: 'url(' + path + 'img/boardmarker-orange.png), auto'},
{ color: 'rgba(150,0,20150,1)', cursor: 'url(' + path + 'img/boardmarker-purple.png), auto'},
{ color: 'rgba(255,220,0,1)', cursor: 'url(' + path + 'img/boardmarker-yellow.png), auto'}
],
chalks: [
{ color: 'rgba(255,255,255,0.5)', cursor: 'url(' + path + 'img/chalk-white.png), auto'},
{ color: 'rgba(96, 154, 244, 0.5)', cursor: 'url(' + path + 'img/chalk-blue.png), auto'},
{ color: 'rgba(237, 20, 28, 0.5)', cursor: 'url(' + path + 'img/chalk-red.png), auto'},
{ color: 'rgba(20, 237, 28, 0.5)', cursor: 'url(' + path + 'img/chalk-green.png), auto'},
{ color: 'rgba(220, 133, 41, 0.5)', cursor: 'url(' + path + 'img/chalk-orange.png), auto'},
{ color: 'rgba(220,0,220,0.5)', cursor: 'url(' + path + 'img/chalk-purple.png), auto'},
{ color: 'rgba(255,220,0,0.5)', cursor: 'url(' + path + 'img/chalk-yellow.png), auto'}
]
},
customcontrols: {
controls: [
{ icon: '<i class="fa fa-pen-square"></i>',
title: 'Toggle chalkboard (B)',
action: 'RevealChalkboard.toggleChalkboard();'
},
{ icon: '<i class="fa fa-pen"></i>',
title: 'Toggle notes canvas (C)',
action: 'RevealChalkboard.toggleNotesCanvas();'
}
]
},
// Learn about plugins: https://revealjs.com/plugins/
plugins: [RevealMarkdown, RevealHighlight, RevealNotes,RevealMenu,RevealChalkboard, RevealCustomControls]
});
Reveal.on( 'slidechanged', event => {
if(erklaerFolie || icons){
if(event.indexh == 2){
document.getElementById("persons").innerHTML = dannyIcon;
}
if(event.indexh == 4){
document.getElementById("persons").innerHTML = nicoIcon;
}
if(event.indexh == 5){
document.getElementById("persons").innerHTML = denisIcon;
}
if(event.indexh == 7){
document.getElementById("persons").innerHTML = georgIcon;
}
}
});
function changeTheme(input) {
var config = {};
config.theme = input.value;
Reveal.getPlugin("RevealChalkboard").configure(config);
input.blur();
}
</script>
</div>
</body>
</html>