Closed
Bug 1194988
Opened 11 years ago
Closed 11 years ago
Be smarter when deleting an entire search result (deleting lots of history entries is very slow)
Categories
(Firefox :: Bookmarks & History, defect)
Firefox
Bookmarks & History
Tracking
()
RESOLVED
WONTFIX
| Tracking | Status | |
|---|---|---|
| firefox43 | --- | affected |
People
(Reporter: reuben, Assigned: reuben)
Details
Attachments
(1 file, 1 obsolete file)
Right now when you search for something on the history window, select all items and hit delete, we iterate over the selection building an ID string and then do a few massive "DELETE WHERE id IN (1, 2, 3, ... 90000)" operations. Deleting lots of entries is mindblowingly slow.
It'd probably be better to do a "DELETE WHERE id in (" + search query + ")", since we know we're deleting all results anyway.
| Assignee | ||
Comment 1•11 years ago
|
||
Marco, before I put any considerable effort into this, does this approach make sense at all? Do you see any obvious red flags?
Along with the added functionality, I'm looking to also fix the places where we iterate over a query's results and build a huge string of IDs just to append them in a DELETE FROM immediately after.
Flags: needinfo?(mak77)
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → reuben.bmo
Comment 2•11 years ago
|
||
I don't think it's going to help with the performance much, there are far too many issues here to address to improve perf (some with much higher impact):
1. the results are synchronous
2. we are not doing proper chunking
3. Places batches are broken
4. we build a too huge .wal journal causing very large IO
5. what you say (too large list of ids)
I agree that we should try to remove pages in a better way, and that's what I'd like to do once we have the new async API in History.jsm. That is I'd prefer if the ui could tell "this query is about this domain from time to time" or "this query is about visits from to", and call the appropriate remove API with appropriate arguments. I'd like to have an appropriate removal API to cope with the few views we have. I don't like much a catch all solution as you suggest cause it's more likely to introduce regressions in the future (like removing something that it shouldn't...)
Unfortunately all this work is in a flux cause all resources have been removed from Places.
Flags: needinfo?(mak77)
Comment 3•11 years ago
|
||
Btw, if this really helps performance a lot I'd like to know, since it would be very interesting for future planning.
| Assignee | ||
Comment 4•11 years ago
|
||
(In reply to Marco Bonardo [::mak] (spotty available until 24 Aug) from comment #3)
> Btw, if this really helps performance a lot I'd like to know, since it would
> be very interesting for future planning.
With the patch that's attached here I wasn't calling CleanupPlacesOnVisitsDelete, so the performance wasn't really representative. I hacked it together to actually do all the DB work, minus notifying observers, and I can remove 11000 entries in a couple of seconds, as opposed to 9000 entries in ~10 minutes without the patch. So it looks like all the observers are what dominate the profile.
| Assignee | ||
Comment 5•11 years ago
|
||
Attachment #8648382 -
Attachment is obsolete: true
| Assignee | ||
Comment 6•11 years ago
|
||
(In reply to Marco Bonardo [::mak] (spotty available until 24 Aug) from comment #2)
> I don't think it's going to help with the performance much, there are far
> too many issues here to address to improve perf (some with much higher
> impact):
> 1. the results are synchronous
> 2. we are not doing proper chunking
> 3. Places batches are broken
> 4. we build a too huge .wal journal causing very large IO
> 5. what you say (too large list of ids)
>
> I agree that we should try to remove pages in a better way, and that's what
> I'd like to do once we have the new async API in History.jsm. That is I'd
> prefer if the ui could tell "this query is about this domain from time to
> time" or "this query is about visits from to", and call the appropriate
> remove API with appropriate arguments. I'd like to have an appropriate
> removal API to cope with the few views we have. I don't like much a catch
> all solution as you suggest cause it's more likely to introduce regressions
> in the future (like removing something that it shouldn't...)
OK, that makes sense. I didn't know about the transition to History.jsm. My idea with taking in a query parameter was that it automatically supports all the cases handled by the UI. My patch just short-circuits the "select all" case, but it could easily change the query so that it handles things like "delete all pages that match my search text and have date < NNNN", etc. If done properly, it should be hard to regress only the removal code without also regressing the queries themselves.
> Unfortunately all this work is in a flux cause all resources have been
> removed from Places.
Resources here means human resources, right? :(
Let me know if there's anything I can help with. I won't have lots of time but there's always weekends. Places is close to my heart, I rely on it almost as an extension of my own memory.
Comment 7•11 years ago
|
||
(In reply to Reuben Morais [:reuben] from comment #4)
> So it looks
> like all the observers are what dominate the profile.
This is what I was expecting... the observers are updating the UI and they do too often. In addition we have IO issues.
(In reply to Reuben Morais [:reuben] from comment #6)
> OK, that makes sense. I didn't know about the transition to History.jsm. My
> idea with taking in a query parameter was that it automatically supports all
> the cases handled by the UI.
Yeah, but those cases are limited and thus I'd prefer to avoid short circuiting them. And then there's the gain, as you noticed just changing this we won't improve much, because the profile is dominated by observers and IO.
> Resources here means human resources, right? :(
yes
The first offending bug we should investigate and fix is bug 871908. Should be the worst offender. The UI changes are dependent on History.jsm work cause we dont' want to maintain 2 parallel APIs if possible (bug 739219 is the big roadblock there)
| Assignee | ||
Updated•11 years ago
|
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Comment 8•4 years ago
|
||
Hi,
Firefox just crashed when I tried to delete 5k+ instances of a website from my history. I resorted to doing it in batches. The largest batch I could do was around 1000, anything larger than that and it would crash.
I'm assuming it's the same issue.
My Laptop has an i5-8250u with 16 GB RAM, so I was surprised that this happened.
This is my first bug report, so I'd appreciate if you would point me in the right direction, should this not be the proper place.
Comment 9•4 years ago
|
||
Is there nothing that can be done to speedup removing selected entries? I understand that each entry is chosen separately but even with ssd drive and quite fast machine it still takes much much time.
You need to log in
before you can comment on or make changes to this bug.
Description
•