Commit 55e386e
committed
perf: optimize SchemaAnalyzer to reduce database queries
Significantly improve performance of optimize analyze command by eliminating
duplicate database queries. This reduces test execution time from ~32s to ~24s
for Oracle tests.
Optimizations:
1. Pass cached table info and foreign keys to IndexSuggestionAnalyzer to
avoid duplicate TableManager::info() and getForeignKeys() calls
2. Optimize getTableRowCount() - only called for tables with issues
3. Remove redundant tableExists() check - handle errors via try-catch
4. Filter Oracle system tables (BIN$%, SYS_%, DUAL) from analysis
5. Pass cached indexes to hasCompositeIndex() to avoid duplicate queries
Performance improvement: ~25% faster (32s -> 24s for 5 Oracle optimize tests)1 parent 152dc49 commit 55e386e
File tree
4 files changed
+68
-28
lines changed- src
- cli
- dialects/oracle
4 files changed
+68
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | | - | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
34 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
38 | 49 | | |
39 | 50 | | |
40 | 51 | | |
| |||
45 | 56 | | |
46 | 57 | | |
47 | 58 | | |
48 | | - | |
| 59 | + | |
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
| |||
225 | 236 | | |
226 | 237 | | |
227 | 238 | | |
| 239 | + | |
228 | 240 | | |
229 | 241 | | |
230 | 242 | | |
231 | | - | |
| 243 | + | |
232 | 244 | | |
233 | 245 | | |
234 | 246 | | |
| |||
285 | 297 | | |
286 | 298 | | |
287 | 299 | | |
288 | | - | |
| 300 | + | |
289 | 301 | | |
290 | 302 | | |
291 | 303 | | |
| |||
397 | 409 | | |
398 | 410 | | |
399 | 411 | | |
| 412 | + | |
400 | 413 | | |
401 | 414 | | |
402 | 415 | | |
403 | | - | |
| 416 | + | |
404 | 417 | | |
405 | 418 | | |
406 | | - | |
407 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
408 | 425 | | |
409 | 426 | | |
410 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| |||
157 | 161 | | |
158 | 162 | | |
159 | 163 | | |
160 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
161 | 169 | | |
162 | 170 | | |
163 | | - | |
| 171 | + | |
164 | 172 | | |
165 | 173 | | |
166 | | - | |
167 | | - | |
168 | 174 | | |
169 | 175 | | |
170 | 176 | | |
171 | 177 | | |
172 | 178 | | |
173 | 179 | | |
174 | | - | |
175 | | - | |
| 180 | + | |
| 181 | + | |
176 | 182 | | |
177 | 183 | | |
178 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2696 | 2696 | | |
2697 | 2697 | | |
2698 | 2698 | | |
2699 | | - | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
2700 | 2705 | | |
2701 | 2706 | | |
2702 | 2707 | | |
| |||
2722 | 2727 | | |
2723 | 2728 | | |
2724 | 2729 | | |
2725 | | - | |
2726 | | - | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
2727 | 2745 | | |
2728 | 2746 | | |
2729 | 2747 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | 200 | | |
202 | 201 | | |
203 | 202 | | |
| |||
0 commit comments