Closed Bug 897074 Opened 10 years ago Closed 9 years ago

getAutoCompleteResults sometimes issues extremely long SQL queries

Categories

(Toolkit :: Form Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: vladan, Assigned: MattN)

Details

(Keywords: main-thread-io, perf)

Attachments

(2 files)

The frecency calculation query in FormHistory.jsm can sometimes be over 1 million characters long! This is bad for performance and also bloats Telemetry pings (bug 896737).
We can probably bail from both loops over search tokens once we're over some threshold:
for (let i = 0; i < searchTokens.length; i++) {

I suspect these are mostly caused by users pasting long text into single-line text fields.
This should reduce the telemetry spam and probably help performance for long texts (maybe accidental pastes) while still preserving the accuracy when we re-use previous results.
Assignee: nobody → MattN+bmo
Status: NEW → ASSIGNED
Attachment #8344118 - Flags: review?(dolske)
Comment on attachment 8344118 [details] [diff] [review]
v.1 Cap to 30 tokens when querying the database

Review of attachment 8344118 [details] [diff] [review]:
-----------------------------------------------------------------

Suggestion: I'd tend to think a much lower value (5? or even 10?) would be plenty.
Attachment #8344118 - Flags: review?(dolske) → review+
(In reply to Justin Dolske [:Dolske] from comment #3)
> Comment on attachment 8344118 [details] [diff] [review]
> v.1 Cap to 30 tokens when querying the database
> 
> Suggestion: I'd tend to think a much lower value (5? or even 10?) would be
> plenty.

Sorry, I started changing this and then got distracted by other bugs and pushed this without lowering it. I pushed a follow-up to lower to 10.

https://hg.mozilla.org/integration/fx-team/rev/c62c26e3c73f
https://hg.mozilla.org/integration/fx-team/rev/1c7402403124
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/c62c26e3c73f
https://hg.mozilla.org/mozilla-central/rev/1c7402403124
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.