ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Django
Indexes
Akshesh Doshi
?
What are database
indexes?
Find the ¡®S¡¯
1 L
2 T
3 P
4 J
5 F
6 I
7 E
8 O
9 A
10 D
11 X
12 G
13 A
14 W
15 S
16 Y
17 O
18 D
19 R
20 Q
21 U
22 P
23 K
24 W
Find the ¡®S¡¯
1 A
2 A
3 D
4 D
5 E
6 F
7 G
8 I
9 J
10 K
11 L
12 O
13 O
14 P
15 P
16 Q
17 R
18 S
19 T
20 U
21 W
22 W
23 X
24 Y
Find the ¡®S¡¯
1 A
2 A
3 D
4 D
5 E
6 F
7 G
8 I
9 J
10 K
11 L
12 O
13 O
14 P
15 P
16 Q
17 R
18 S
19 T
20 U
21 W
22 W
23 X
24 Y
fields = [¡®alphabet¡¯]
Count the ¡®A¡¯s
1 G
2 Q
3 V
4 J
5 X
6 F
7 B
8 Y
9 I
10 K
11 V
12 U
13 J
14 A
15 D
16 W
17 O
18 R
19 L
20 A
21 V
22 D
23 O
24 E
25 V
26 E
27 H
28 G
29 L
30 F
31 R
32 D
33 N
34 U
35 Z
36 N
37 Y
38 T
39 V
40 C
41 U
42 L
43 A
44 Y
45 X
46 A
47 D
48 C
Count the ¡®A¡¯s
1 A
2 A
3 A
4 A
5 B
6 C
7 C
8 D
9 D
10 D
11 D
12 E
13 E
14 F
15 F
16 G
17 G
18 H
19 I
20 J
21 J
22 K
23 L
24 L
25 L
26 N
27 N
28 O
29 O
30 Q
31 R
32 R
33 T
34 U
35 U
36 U
37 V
38 V
39 V
40 V
41 V
42 W
43 X
44 X
45 Y
46 Y
47 Y
48 Z
Count the ¡®A¡¯s
1 A
2 A
3 A
4 A
5 B
6 C
7 C
8 D
9 D
10 D
11 D
12 E
13 E
14 F
15 F
16 G
17 G
18 H
19 I
20 J
21 J
22 K
23 L
24 L
25 L
26 N
27 N
28 O
29 O
30 Q
31 R
32 R
33 T
34 U
35 U
36 U
37 V
38 V
39 V
40 V
41 V
42 W
43 X
44 X
45 Y
46 Y
47 Y
48 Z
Grouping and aggregation!
Count the ¡®A¡¯s
1 A
2 A
3 A
4 A
5 B
6 C
7 C
8 D
9 D
10 D
11 D
12 E
13 E
14 F
15 F
16 G
17 G
18 H
19 I
20 J
21 J
22 K
23 L
24 L
25 L
26 N
27 N
28 O
29 O
30 Q
31 R
32 R
33 T
34 U
35 U
36 U
37 V
38 V
39 V
40 V
41 V
42 W
43 X
44 X
45 Y
46 Y
47 Y
48 Z
fields = [¡®alphabet¡¯]
Multi-column indexes
9 27-Feb-19 Taylor Swift
10 15-Feb-19 BNK
11 15-Feb-19 Bruno Mars
12 15-Feb-19 Train
13 08-Feb-19 BNK
14 08-Feb-19 Eagles
15 08-Feb-19 Eminem
16 08-Feb-19 Nickelback
1 15-Mar-19 BNK
2 15-Mar-19 Coldplay
3 09-Mar-19 BNK
4 09-Mar-19 Maroon5
5 09-Mar-19 Nickelback
6 09-Mar-19 Train
7 27-Feb-19 Coke Studio
8 27-Feb-19 Eagles
Multi-column indexes
9 27-Feb-19 Taylor Swift
10 15-Feb-19 BNK
11 15-Feb-19 Bruno Mars
12 15-Feb-19 Train
13 08-Feb-19 BNK
14 08-Feb-19 Eagles
15 08-Feb-19 Eminem
16 08-Feb-19 Nickelback
1 15-Mar-19 BNK
2 15-Mar-19 Coldplay
3 09-Mar-19 BNK
4 09-Mar-19 Maroon5
5 09-Mar-19 Nickelback
6 09-Mar-19 Train
7 27-Feb-19 Coke Studio
8 27-Feb-19 Eagles
fields = [¡®-date¡¯, ¡®band¡¯]
Gist
Hash Spatial
Brin
PostgreSQL
Oracle
SQLite3
MySQL
How do I
create
database
indexes?
Enter ORM!
? To whom it matters ¨C Object Relational Mapping
? Write code in your favourite programming language!
ThaiPy meetup - Indexes and Django
ThaiPy meetup - Indexes and Django
Django¡¯s ORM
? Django is Python¡¯s macro-web-framework
Let¡¯s
look at
the code
#OpenSource
? Google Summer of Code
?
/akki
/akshesh-doshi

More Related Content

ThaiPy meetup - Indexes and Django

  • 3. Find the ¡®S¡¯ 1 L 2 T 3 P 4 J 5 F 6 I 7 E 8 O 9 A 10 D 11 X 12 G 13 A 14 W 15 S 16 Y 17 O 18 D 19 R 20 Q 21 U 22 P 23 K 24 W
  • 4. Find the ¡®S¡¯ 1 A 2 A 3 D 4 D 5 E 6 F 7 G 8 I 9 J 10 K 11 L 12 O 13 O 14 P 15 P 16 Q 17 R 18 S 19 T 20 U 21 W 22 W 23 X 24 Y
  • 5. Find the ¡®S¡¯ 1 A 2 A 3 D 4 D 5 E 6 F 7 G 8 I 9 J 10 K 11 L 12 O 13 O 14 P 15 P 16 Q 17 R 18 S 19 T 20 U 21 W 22 W 23 X 24 Y fields = [¡®alphabet¡¯]
  • 6. Count the ¡®A¡¯s 1 G 2 Q 3 V 4 J 5 X 6 F 7 B 8 Y 9 I 10 K 11 V 12 U 13 J 14 A 15 D 16 W 17 O 18 R 19 L 20 A 21 V 22 D 23 O 24 E 25 V 26 E 27 H 28 G 29 L 30 F 31 R 32 D 33 N 34 U 35 Z 36 N 37 Y 38 T 39 V 40 C 41 U 42 L 43 A 44 Y 45 X 46 A 47 D 48 C
  • 7. Count the ¡®A¡¯s 1 A 2 A 3 A 4 A 5 B 6 C 7 C 8 D 9 D 10 D 11 D 12 E 13 E 14 F 15 F 16 G 17 G 18 H 19 I 20 J 21 J 22 K 23 L 24 L 25 L 26 N 27 N 28 O 29 O 30 Q 31 R 32 R 33 T 34 U 35 U 36 U 37 V 38 V 39 V 40 V 41 V 42 W 43 X 44 X 45 Y 46 Y 47 Y 48 Z
  • 8. Count the ¡®A¡¯s 1 A 2 A 3 A 4 A 5 B 6 C 7 C 8 D 9 D 10 D 11 D 12 E 13 E 14 F 15 F 16 G 17 G 18 H 19 I 20 J 21 J 22 K 23 L 24 L 25 L 26 N 27 N 28 O 29 O 30 Q 31 R 32 R 33 T 34 U 35 U 36 U 37 V 38 V 39 V 40 V 41 V 42 W 43 X 44 X 45 Y 46 Y 47 Y 48 Z Grouping and aggregation!
  • 9. Count the ¡®A¡¯s 1 A 2 A 3 A 4 A 5 B 6 C 7 C 8 D 9 D 10 D 11 D 12 E 13 E 14 F 15 F 16 G 17 G 18 H 19 I 20 J 21 J 22 K 23 L 24 L 25 L 26 N 27 N 28 O 29 O 30 Q 31 R 32 R 33 T 34 U 35 U 36 U 37 V 38 V 39 V 40 V 41 V 42 W 43 X 44 X 45 Y 46 Y 47 Y 48 Z fields = [¡®alphabet¡¯]
  • 10. Multi-column indexes 9 27-Feb-19 Taylor Swift 10 15-Feb-19 BNK 11 15-Feb-19 Bruno Mars 12 15-Feb-19 Train 13 08-Feb-19 BNK 14 08-Feb-19 Eagles 15 08-Feb-19 Eminem 16 08-Feb-19 Nickelback 1 15-Mar-19 BNK 2 15-Mar-19 Coldplay 3 09-Mar-19 BNK 4 09-Mar-19 Maroon5 5 09-Mar-19 Nickelback 6 09-Mar-19 Train 7 27-Feb-19 Coke Studio 8 27-Feb-19 Eagles
  • 11. Multi-column indexes 9 27-Feb-19 Taylor Swift 10 15-Feb-19 BNK 11 15-Feb-19 Bruno Mars 12 15-Feb-19 Train 13 08-Feb-19 BNK 14 08-Feb-19 Eagles 15 08-Feb-19 Eminem 16 08-Feb-19 Nickelback 1 15-Mar-19 BNK 2 15-Mar-19 Coldplay 3 09-Mar-19 BNK 4 09-Mar-19 Maroon5 5 09-Mar-19 Nickelback 6 09-Mar-19 Train 7 27-Feb-19 Coke Studio 8 27-Feb-19 Eagles fields = [¡®-date¡¯, ¡®band¡¯]
  • 14. Enter ORM! ? To whom it matters ¨C Object Relational Mapping ? Write code in your favourite programming language!
  • 17. Django¡¯s ORM ? Django is Python¡¯s macro-web-framework