Commit 8c4c1a3
committed
Replace OR with IS DISTINCT FROM for suppression checks
It turns out that the PostgreSQL query planner yields suboptimal plans for `("SUPPRESSED" IS NULL OR NOT "SUPPRESSED")` conditions. `"SUPPRESSED" IS DISTINCT FROM TRUE` is semantically equivalent, avoids the `OR`, and causes the planner to generate better plans.
Eventually the `"SUPPRESSED"` column should be made non-null, but this change provides a quick relief without the need for an expensive migration.
Signed-off-by: nscuro <[email protected]>1 parent 1429324 commit 8c4c1a3
File tree
3 files changed
+21
-11
lines changed- apiserver/src/main/java/org/dependencytrack/persistence/jdbi
3 files changed
+21
-11
lines changedLines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
188 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
189 | 192 | | |
190 | 193 | | |
191 | 194 | | |
192 | 195 | | |
193 | 196 | | |
194 | | - | |
| 197 | + | |
195 | 198 | | |
196 | 199 | | |
197 | 200 | | |
| |||
292 | 295 | | |
293 | 296 | | |
294 | 297 | | |
295 | | - | |
| 298 | + | |
296 | 299 | | |
297 | 300 | | |
298 | 301 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| |||
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
| |||
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
276 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
277 | 281 | | |
278 | 282 | | |
279 | 283 | | |
280 | 284 | | |
281 | 285 | | |
282 | 286 | | |
283 | | - | |
| 287 | + | |
284 | 288 | | |
285 | 289 | | |
286 | 290 | | |
| |||
302 | 306 | | |
303 | 307 | | |
304 | 308 | | |
305 | | - | |
| 309 | + | |
306 | 310 | | |
307 | 311 | | |
308 | 312 | | |
| |||
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
| 328 | + | |
324 | 329 | | |
325 | 330 | | |
326 | 331 | | |
| |||
375 | 380 | | |
376 | 381 | | |
377 | 382 | | |
378 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
379 | 386 | | |
380 | 387 | | |
381 | 388 | | |
382 | 389 | | |
383 | 390 | | |
384 | 391 | | |
385 | 392 | | |
386 | | - | |
| 393 | + | |
387 | 394 | | |
388 | 395 | | |
389 | 396 | | |
| |||
0 commit comments