{"action":"reopened","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/2015","labels_url":"https://api.github.com/repos/realm/realm-java/issues/2015/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/2015/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/2015/events","html_url":"https://github.com/realm/realm-java/issues/2015","id":124371878,"number":2015,"title":"Performance in removing objects","user":{"login":"douglasjunior","id":1512341,"avatar_url":"https://avatars.githubusercontent.com/u/1512341?v=3","gravatar_id":"","url":"https://api.github.com/users/douglasjunior","html_url":"https://github.com/douglasjunior","followers_url":"https://api.github.com/users/douglasjunior/followers","following_url":"https://api.github.com/users/douglasjunior/following{/other_user}","gists_url":"https://api.github.com/users/douglasjunior/gists{/gist_id}","starred_url":"https://api.github.com/users/douglasjunior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/douglasjunior/subscriptions","organizations_url":"https://api.github.com/users/douglasjunior/orgs","repos_url":"https://api.github.com/users/douglasjunior/repos","events_url":"https://api.github.com/users/douglasjunior/events{/privacy}","received_events_url":"https://api.github.com/users/douglasjunior/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/realm/realm-java/labels/P1","name":"P1","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"rrrlasse","id":1110156,"avatar_url":"https://avatars.githubusercontent.com/u/1110156?v=3","gravatar_id":"","url":"https://api.github.com/users/rrrlasse","html_url":"https://github.com/rrrlasse","followers_url":"https://api.github.com/users/rrrlasse/followers","following_url":"https://api.github.com/users/rrrlasse/following{/other_user}","gists_url":"https://api.github.com/users/rrrlasse/gists{/gist_id}","starred_url":"https://api.github.com/users/rrrlasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrrlasse/subscriptions","organizations_url":"https://api.github.com/users/rrrlasse/orgs","repos_url":"https://api.github.com/users/rrrlasse/repos","events_url":"https://api.github.com/users/rrrlasse/events{/privacy}","received_events_url":"https://api.github.com/users/rrrlasse/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-12-30T16:48:48Z","updated_at":"2016-01-22T05:13:51Z","closed_at":null,"body":"I'm having performance problems with Realm, and I wonder if I'm doing something wrong.\r\n\r\nI'm removing about 6,000 objects using the `RealmResults.clear()`. My query is performed by a `@Index` property.\r\n\r\nEntity:\r\n```java\r\npublic class Foo extends RealmObject {\r\n      @PrimaryKey\r\n      private long id;\r\n  \r\n      @Index\r\n      private long bar;\r\n      // getters and setters\r\n}\r\n```\r\nMy code to remove:\r\n```java\r\nRealmResults<Foo> result = realm.where(Foo.class).equalTo(\"bar\", barId).findAll();\r\nresult.clear();\r\n```\r\nWhen the `Foo` table has 7,000 records in total, the removal happens almost instantly. However, if the total is 300,000 records, it takes about 50 seconds to call the `clear()`.\r\n\r\nThe same problem I have to make \"update\" on several objects.\r\n\r\n```java\r\nRealmResults<Foo> result = realm.where(Foo.class).equalTo(\"bar\", barId).findAll();\r\nfor (Foo foo : result) {\r\n   foo.setValue(newValue);\r\n}\r\n```\r\n\r\nI can do something to fix it?\r\n\r\n*I'm using the Realm 0.87.1 with Android 4.2.2 on a Galaxy Tab 3 Lite.* "}}