Project

General

Profile

Bug #10028 » links_query_explained.txt

Radhika Chippada, 10/25/2016 10:00 PM

 
1
With 1,000 rows:
2

    
3
Without index:
4

    
5
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
6
                       QUERY PLAN                       
7
--------------------------------------------------------
8
 Seq Scan on links  (cost=0.00..33.51 rows=3 width=224)
9
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
10
(2 rows)
11

    
12
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
13
                       QUERY PLAN                        
14
---------------------------------------------------------
15
 Seq Scan on links  (cost=0.00..33.51 rows=14 width=224)
16
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
17
(2 rows)
18

    
19
With index
20

    
21
arvados_dev=> CREATE INDEX links_varchar_index_on_head_uuid ON links (head_uuid varchar_pattern_ops);
22
CREATE INDEX
23
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
24
                       QUERY PLAN                       
25
--------------------------------------------------------
26
 Seq Scan on links  (cost=0.00..33.51 rows=3 width=224)
27
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
28
(2 rows)
29

    
30
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
31
                                                      QUERY PLAN                                                      
32
----------------------------------------------------------------------------------------------------------------------
33
 Bitmap Heap Scan on links  (cost=4.38..23.84 rows=14 width=224)
34
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
35
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.38 rows=13 width=0)
36
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
37
(4 rows)
38

    
39

    
40
======
41

    
42
With 2,000 rows:
43

    
44
Without index:
45

    
46
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
47
                       QUERY PLAN                       
48
--------------------------------------------------------
49
 Seq Scan on links  (cost=0.00..51.06 rows=5 width=224)
50
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
51
(2 rows)
52

    
53
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
54
                       QUERY PLAN                        
55
---------------------------------------------------------
56
 Seq Scan on links  (cost=0.00..51.06 rows=21 width=224)
57
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
58
(2 rows)
59

    
60
With index:
61

    
62
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
63
                       QUERY PLAN                       
64
--------------------------------------------------------
65
 Seq Scan on links  (cost=0.00..51.06 rows=3 width=224)
66
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
67
(2 rows)
68

    
69
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
70
                                                      QUERY PLAN                                                      
71
----------------------------------------------------------------------------------------------------------------------
72
 Bitmap Heap Scan on links  (cost=4.38..29.20 rows=14 width=224)
73
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
74
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.38 rows=13 width=0)
75
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
76
(4 rows)
77

    
78

    
79
============
80

    
81
With 3,000 rows
82

    
83
Without index:
84

    
85
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
86
                       QUERY PLAN                       
87
--------------------------------------------------------
88
 Seq Scan on links  (cost=0.00..78.39 rows=4 width=224)
89
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
90
(2 rows)
91

    
92
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
93
                       QUERY PLAN                        
94
---------------------------------------------------------
95
 Seq Scan on links  (cost=0.00..81.51 rows=14 width=224)
96
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
97
(2 rows)
98

    
99

    
100
With index:
101

    
102
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
103
                       QUERY PLAN                       
104
--------------------------------------------------------
105
 Seq Scan on links  (cost=0.00..81.51 rows=3 width=224)
106
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
107
(2 rows)
108

    
109
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
110
                                                      QUERY PLAN                                                      
111
----------------------------------------------------------------------------------------------------------------------
112
 Bitmap Heap Scan on links  (cost=4.38..33.75 rows=14 width=224)
113
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
114
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.38 rows=13 width=0)
115
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
116
(4 rows)
117

    
118

    
119
============
120

    
121
With 4,000 rows
122

    
123
Without index:
124

    
125
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
126
                       QUERY PLAN                        
127
---------------------------------------------------------
128
 Seq Scan on links  (cost=0.00..129.51 rows=3 width=224)
129
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
130
(2 rows)
131

    
132
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
133
                        QUERY PLAN                        
134
----------------------------------------------------------
135
 Seq Scan on links  (cost=0.00..129.51 rows=14 width=224)
136
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
137
(2 rows)
138

    
139

    
140
With index:
141

    
142
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
143
                       QUERY PLAN                        
144
---------------------------------------------------------
145
 Seq Scan on links  (cost=0.00..105.01 rows=3 width=224)
146
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
147
(2 rows)
148

    
149
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
150
                                                      QUERY PLAN                                                      
151
----------------------------------------------------------------------------------------------------------------------
152
 Bitmap Heap Scan on links  (cost=4.38..35.73 rows=14 width=224)
153
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
154
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.38 rows=13 width=0)
155
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
156
(4 rows)
157

    
158

    
159
==========
160

    
161
With 5,000 rows:
162

    
163
Without index:
164

    
165
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
166
                       QUERY PLAN                        
167
---------------------------------------------------------
168
 Seq Scan on links  (cost=0.00..129.51 rows=3 width=224)
169
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
170
(2 rows)
171

    
172
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
173
                        QUERY PLAN                        
174
----------------------------------------------------------
175
 Seq Scan on links  (cost=0.00..129.51 rows=14 width=224)
176
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
177
(2 rows)
178

    
179

    
180
With index:
181

    
182
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
183
                       QUERY PLAN                        
184
---------------------------------------------------------
185
 Seq Scan on links  (cost=0.00..129.51 rows=3 width=224)
186
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
187
(2 rows)
188

    
189
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
190
                                                      QUERY PLAN                                                      
191
----------------------------------------------------------------------------------------------------------------------
192
 Bitmap Heap Scan on links  (cost=4.38..37.31 rows=14 width=224)
193
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
194
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.38 rows=13 width=0)
195
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
196
(4 rows)
197

    
198

    
199
===========
200

    
201
with 10,000 rows:
202

    
203
Without index:
204

    
205
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
206
                       QUERY PLAN                        
207
---------------------------------------------------------
208
 Seq Scan on links  (cost=0.00..248.01 rows=3 width=224)
209
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
210
(2 rows)
211

    
212
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
213
                        QUERY PLAN                        
214
----------------------------------------------------------
215
 Seq Scan on links  (cost=0.00..248.01 rows=14 width=224)
216
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
217
(2 rows)
218

    
219
With index:
220

    
221
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
222
                       QUERY PLAN                        
223
---------------------------------------------------------
224
 Seq Scan on links  (cost=0.00..248.01 rows=3 width=224)
225
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
226
(2 rows)
227

    
228
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
229
                                                      QUERY PLAN                                                      
230
----------------------------------------------------------------------------------------------------------------------
231
 Bitmap Heap Scan on links  (cost=4.39..43.87 rows=14 width=224)
232
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
233
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.38 rows=13 width=0)
234
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
235
(4 rows)
236

    
237

    
238
========
239

    
240
With 20,000 rows:
241

    
242
Without index:
243

    
244

    
245
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
246
                       QUERY PLAN                        
247
---------------------------------------------------------
248
 Seq Scan on links  (cost=0.00..484.68 rows=3 width=224)
249
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
250
(2 rows)
251

    
252
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
253
                        QUERY PLAN                        
254
----------------------------------------------------------
255
 Seq Scan on links  (cost=0.00..484.68 rows=14 width=224)
256
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
257
(2 rows)
258

    
259

    
260
With index:
261

    
262
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
263
                       QUERY PLAN                        
264
---------------------------------------------------------
265
 Seq Scan on links  (cost=0.00..484.68 rows=3 width=224)
266
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
267
(2 rows)
268

    
269
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
270
                                                      QUERY PLAN                                                      
271
----------------------------------------------------------------------------------------------------------------------
272
 Bitmap Heap Scan on links  (cost=4.39..47.42 rows=14 width=224)
273
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
274
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.39 rows=13 width=0)
275
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
276
(4 rows)
277

    
278

    
279

    
280
==========
281

    
282
With 30,000 rows
283

    
284
Without index: 
285

    
286
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
287
                       QUERY PLAN                        
288
---------------------------------------------------------
289
 Seq Scan on links  (cost=0.00..717.81 rows=4 width=224)
290
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
291
(2 rows)
292

    
293
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
294
                        QUERY PLAN                        
295
----------------------------------------------------------
296
 Seq Scan on links  (cost=0.00..717.81 rows=20 width=224)
297
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
298
(2 rows)
299

    
300

    
301
With index:
302

    
303

    
304
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
305
                       QUERY PLAN                        
306
---------------------------------------------------------
307
 Seq Scan on links  (cost=0.00..726.01 rows=3 width=224)
308
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
309
(2 rows)
310

    
311
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
312
                                                      QUERY PLAN                                                      
313
----------------------------------------------------------------------------------------------------------------------
314
 Bitmap Heap Scan on links  (cost=4.39..49.05 rows=14 width=224)
315
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
316
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.39 rows=13 width=0)
317
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
318
(4 rows)
319

    
320

    
321

    
322
===========
323

    
324
With 50,000 rows
325

    
326
Without index:
327

    
328
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
329
                        QUERY PLAN                        
330
----------------------------------------------------------
331
 Seq Scan on links  (cost=0.00..1203.01 rows=2 width=223)
332
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
333
(2 rows)
334

    
335
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
336
                        QUERY PLAN                         
337
-----------------------------------------------------------
338
 Seq Scan on links  (cost=0.00..1203.01 rows=14 width=223)
339
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
340
(2 rows)
341

    
342
With index:
343

    
344
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
345
                        QUERY PLAN                        
346
----------------------------------------------------------
347
 Seq Scan on links  (cost=0.00..1203.01 rows=2 width=223)
348
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
349
(2 rows)
350

    
351
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
352
                                                      QUERY PLAN                                                      
353
----------------------------------------------------------------------------------------------------------------------
354
 Bitmap Heap Scan on links  (cost=4.41..54.04 rows=14 width=223)
355
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
356
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.40 rows=14 width=0)
357
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
358
(4 rows)
359

    
360
===========
361

    
362
With 160,000 rows
363

    
364
Without index:
365

    
366
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
367
                        QUERY PLAN                        
368
----------------------------------------------------------
369
 Seq Scan on links  (cost=0.00..3811.89 rows=1 width=225)
370
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
371
(2 rows)
372

    
373
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
374
                        QUERY PLAN                         
375
-----------------------------------------------------------
376
 Seq Scan on links  (cost=0.00..3811.89 rows=30 width=225)
377
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
378
(2 rows)
379

    
380
With index:
381

    
382
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
383
                        QUERY PLAN                        
384
----------------------------------------------------------
385
 Seq Scan on links  (cost=0.00..3828.01 rows=1 width=225)
386
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
387
(2 rows)
388

    
389
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
390
                                                      QUERY PLAN                                                      
391
----------------------------------------------------------------------------------------------------------------------
392
 Bitmap Heap Scan on links  (cost=4.60..113.44 rows=30 width=225)
393
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
394
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.59 rows=30 width=0)
395
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
396
(4 rows)
397

    
398

    
399
===========
400

    
401
With 250,000 rows
402

    
403
Without index:
404

    
405
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
406
                        QUERY PLAN                        
407
----------------------------------------------------------
408
 Seq Scan on links  (cost=0.00..5985.29 rows=1 width=224)
409
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
410
(2 rows)
411

    
412
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
413
                        QUERY PLAN                         
414
-----------------------------------------------------------
415
 Seq Scan on links  (cost=0.00..5985.29 rows=11 width=224)
416
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
417

    
418

    
419
With index:
420

    
421
arvados_dev=> explain select * from links where head_uuid like '_____-j7d0g-%';
422
                        QUERY PLAN                        
423
----------------------------------------------------------
424
 Seq Scan on links  (cost=0.00..5985.29 rows=1 width=224)
425
   Filter: ((head_uuid)::text ~~ '_____-j7d0g-%'::text)
426
(2 rows)
427

    
428
arvados_dev=> explain select * from links where head_uuid like 'zzzzz-j7d0g-%';
429
                                                      QUERY PLAN                                                      
430
----------------------------------------------------------------------------------------------------------------------
431
 Bitmap Heap Scan on links  (cost=4.43..46.52 rows=11 width=224)
432
   Filter: ((head_uuid)::text ~~ 'zzzzz-j7d0g-%'::text)
433
   ->  Bitmap Index Scan on links_varchar_index_on_head_uuid  (cost=0.00..4.42 rows=11 width=0)
434
         Index Cond: (((head_uuid)::text ~>=~ 'zzzzz-j7d0g-'::text) AND ((head_uuid)::text ~<~ 'zzzzz-j7d0g.'::text))
435
(4 rows)
436

    
(1-1/3)