0

I have treemap in mapdb with 150K entries. Calling treemap.clear() takes minutes. How can I do this quickly? Creating new one with

db.treeMap("pageCache").create();

gives crash org.mapdb.DBException$WrongConfiguration: Named record already exists: pageCache. How can I clear collection in a reasonable time?

Thanx.

Stepan Yakovenko
  • 8,670
  • 28
  • 113
  • 206
  • Have you considered what you're trying to do? I am not familiar with mapdb, but it appears your map is backed by a database, so in order to clear it it will likely have to delete things from the database. It sounds like it is clearing the 150k entries one at a time; this might be the only way it has, since there is nothing in the map structure to collectively delete them with one database command (I think in terms of SQL for this sort of thing). To do it more quickly, you may need something at the database level that says "delete all records matching X condition". – arcy Oct 13 '18 at 14:08

1 Answers1

1

try .createOrOpen() when building your treemap.

KRK Owner
  • 762
  • 7
  • 16