SQLite - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: General Help (/Forum-General-Help) +--- Thread: SQLite (/Thread-SQLite) |
SQLite - Llirik - 12-02-2020 12:08 AM I have a TOP on server, but after Delete chars from TOP he putted in file in INVIS mode. My site don't show this players but in FILE 'top.db' they stays when i'm open with Notepad. [function f_top8] if !(<ldb.connected>) ldb.connect "scripts/custom/top.db" endif if (<ldb.connected>) ldb.execute DELETE FROM top // don't work TRUNCATE for x 0 <eval <serv.accounts> -1> for y 0 <eval <Serv.MaxCharsPerAccount>> ref2 = <serv.account.<dlocal.x>.char.<dlocal.y>> if (<ref2.skilltotal>>0) && (<ref2.account.plevel>==1) ldb.execute INSERT INTO 'top' ('name','skilltotal') VALUES ("<ref2.name>","<fval <ref2.skilltotal>>") endif endfor endfor // maybee this ldb.Delete bla bla bla? ldb.close endif I'm be forgive this problem, but if File 'top.db' be very big on hard-disk (20 MB :-))? Thank you! RE: SQLite - Feeh - 12-05-2020 08:10 AM Imagine that you have a really huge database inside your SQLite file. Now lets say you delete one of the first elements you've inserted in your DB file. This 'block' of data becomes unused, but if you rewrite the entire DB for each operation, to remove the unused blocks you will waste a lot of time and processing power. SQLite comes with a VACUUM command which addresses this issue, so you may need to run the VACUUM command each time you want to eliminate those unused blocks (at 00:00 each day/week or when there is a low player count in your server... it is up to you) Be aware that depending on the size of your DB, it may take some time, if running the command using the Sphere's interface you may experience some slowdown on your server https://www.sqlitetutorial.net/sqlite-vacuum/ https://stackoverflow.com/questions/18126997/how-to-vacuum-sqlite-database RE: SQLite - Llirik - 12-06-2020 08:03 AM I'm understand. Thank you! |