- Notifications
You must be signed in to change notification settings - Fork5
Commit1faf866
committed
Fix logical errors in tsquery selectivity estimation for prefix queries.
I made multiple errors in commit97532f7,stemming mostly from failure to think about the available frequency dataas being element frequencies not value frequencies (so that occurrences ofdifferent elements are not mutually exclusive). This led to sillinessessuch as estimating that "word" would match more rows than "word:*".The choice to clamp to a minimum estimate of DEFAULT_TS_MATCH_SEL alsoseems pretty ill-considered in hindsight, as it would frequently result inan estimate much larger than the available data suggests. We do need somesort of clamp, since a pattern not matching any of the MCELEMs probablystill needs a selectivity estimate of more than zero. I chose instead toclamp to at least what a non-MCELEM word would be estimated as, preservingthe property that "word:*" doesn't get an estimate less than plain "word",whether or not the word appears in MCELEM.Per investigation of a gripe from Bill Martin, though I suspect that hisexample case actually isn't even reaching the erroneous code.Back-patch to 9.1 where this code was introduced.1 parent4bc0d2e commit1faf866
1 file changed
+28
-16
lines changedLines changed: 28 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
304 | 304 |
| |
305 | 305 |
| |
306 | 306 |
| |
307 |
| - | |
308 |
| - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
309 | 310 |
| |
310 | 311 |
| |
311 |
| - | |
312 |
| - | |
313 |
| - | |
314 |
| - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
315 | 320 |
| |
316 | 321 |
| |
317 |
| - | |
| 322 | + | |
318 | 323 |
| |
319 | 324 |
| |
320 | 325 |
| |
321 | 326 |
| |
322 | 327 |
| |
323 |
| - | |
| 328 | + | |
| 329 | + | |
324 | 330 |
| |
325 | 331 |
| |
326 | 332 |
| |
| |||
329 | 335 |
| |
330 | 336 |
| |
331 | 337 |
| |
332 |
| - | |
333 |
| - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
334 | 343 |
| |
335 | 344 |
| |
336 |
| - | |
337 |
| - | |
338 |
| - | |
339 |
| - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
340 | 350 |
| |
341 | 351 |
| |
342 | 352 |
| |
343 |
| - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
344 | 356 |
| |
345 |
| - | |
| 357 | + | |
346 | 358 |
| |
347 | 359 |
| |
348 | 360 |
| |
|
0 commit comments
Comments
(0)