Commit 5391e1b
committed
HOTFIX: linksearchtotal_collect query performance
reworked query template to go from this:
```
SELECT COUNT(*) FROM externallinks
WHERE el_to_domain_index LIKE '%com.example%'
AND el_to_path LIKE '%%'
```
to this:
```
SELECT COUNT(*) FROM externallinks
WHERE el_to_domain_index LIKE 'http://com.example%'
SELECT COUNT(*) FROM externallinks
WHERE el_to_domain_index LIKE 'https://com.example%'
```
and from this:
```
SELECT COUNT(*) FROM externallinks
WHERE el_to_domain_index LIKE '%com.example%'
AND el_to_path LIKE '%/examples/%'
```
to this:
```
SELECT COUNT(*) FROM externallinks
WHERE el_to_domain_index LIKE 'http://com.example%'
AND el_to_path LIKE '/examples/%'
SELECT COUNT(*) FROM externallinks
WHERE el_to_domain_index LIKE 'https://com.example%'
AND el_to_path LIKE '/examples/%'
```
which is significantly faster since it avoids wildcards at the start of
the condition.
See: https://phabricator.wikimedia.org/T403209
Bug: T4032091 parent c5cb81a commit 5391e1b
1 file changed
Lines changed: 22 additions & 15 deletions
Lines changed: 22 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
53 | | - | |
54 | 57 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
| 80 | + | |
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
0 commit comments