Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQLite
Author Message
Llirik
Journeyman
*

Posts: 115
Likes Given: 0
Likes Received: 10 in 8 posts
Joined: Feb 2015
Reputation: 0

UO Forum

Post: #1
SQLite
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 Sad
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!
(This post was last modified: 12-02-2020 12:33 AM by Llirik.)
12-02-2020 12:08 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Feeh
Sphere Developer
*****

Posts: 156
Likes Given: 6
Likes Received: 40 in 29 posts
Joined: Sep 2012
Reputation: 4



Post: #2
RE: SQLite
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/1812...e-database

Feeh/Epila - Nightly releases / SphereWiki / Github Issues / Sphere's GitHub
(This post was last modified: 12-05-2020 08:11 AM by Feeh.)
12-05-2020 08:10 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 2 users Like Feeh's post
Llirik
Journeyman
*

Posts: 115
Likes Given: 0
Likes Received: 10 in 8 posts
Joined: Feb 2015
Reputation: 0

UO Forum

Post: #3
RE: SQLite
I'm understand. Thank you!
12-06-2020 08:03 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)