func queryAndDelete(db storage.Engine, points, series int) { // query the database startCount := points / series / 4 endCount := points * 3 / series / 4 total := 0 var d time.Duration for series -= 1; series >= 0; series-- { count := 0 var delStart []byte var delEnd []byte query(db, int64(series), func(itr storage.Iterator) { count++ if count == startCount { delStart = itr.Key() } if count == endCount-1 { delEnd = itr.Key() total += endCount - startCount } }) start := time.Now() err := db.Del(delStart, delEnd) if err != nil { panic(err) } d += time.Now().Sub(start) } fmt.Printf("Took %s to delete %d points\n", d, total) start := time.Now() db.Compact() fmt.Printf("Took %s to compact\n", time.Now().Sub(start)) }