I just tried that prepare and it worked very very well xD
local db = sqlite3.open(cPluginManager:Get():GetCurrentPlugin():GetLocalFolder() .. "/storage.sqlite") db:exec("BEGIN TRANSACTION") -- Postpone all DB changes into one big step, to save on disk I/O local stmt, err, errmsg = db:prepare("INSERT INTO marker (X, Y, Z, World, Player_name) VALUES (?, ?, ?, ?, ?)") if (not stmt) then LOG(err .. " " .. errmsg) end for X in pairs(marker_temp) do for Y in pairs(marker_temp[X]) do for Z in pairs(marker_temp[X][Y]) do for World_name in pairs(marker_temp[X][Y][Z]) do for Player_name in pairs(marker_temp[X][Y][Z][World_name]) do LOG("Saving: " .. X .. "X " .. Y .. "Y " .. Z .. "Z " .. World_name .. " " .. Player_name) stmt:bind_names({X, Y, Z, World_name, Player_name}) stmt:step() -- execute the statement (once) stmt:reset() -- reset the statement so that the next "wall" values can be inserted end end end end end stmt:finalize() db:exec("COMMIT") -- Now put everything queued so far into the DB file marker_temp = {}everything is now saving in a second