[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  When to consider a SQL database over script-side data storage?
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

When to consider a SQL database over script-side data storage?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by Sickent   USA  (8 posts)  [Biography] bio
Date Fri 01 Jan 2016 07:28 PM (UTC)
tl;dr When do you consider using a SQL database over writing all the information into a lua script/plugin, if you're not worried about storage functionality over continuing sessions of play?

I want to write a map plugin for myself. Because a lot of information can be involved in a client-side mapper, I don't know if starting a SQL database is better for performance than just continuing to write tables in a lua script/plugins.

One of the reasons I stick with MUSH is performance; lua and scripts are processed ridiculously fast, especially when compared to the Z/CMud I came from. Because of those past horrid experiences, stability and performance are now my first concerns with client.

I realize that when you use a script or plugin in MUSH, it loads the entire file into memory and works it from there. When you work with SQL, or any other database I imagine, only requested information is loaded into memory, as the rest of the database is kept on the hard disk.

So this is my comp.


There a reason I can't just write everything I want to a script/plugin, or multiple plugins? What thresholds in data, field size, or whatever are needed to make you start considering writing and accessing your information to SQL database? I have like 16gb of fairly fast memory, and I can't imagine even loading the entire world of a game in a go is going to be larger than, say 50mg of text.

Thank you for your help.
[Go to top] top

Posted by Nick Gammon   Australia  (21,564 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 02 Jan 2016 01:35 AM (UTC)
For large databases I would use SQLite3. That was used by me in writing the mapper for Aardwolf and Achaea, and it loads room information very quickly. (I cached room data in a table once loaded to speed things up a bit).

The advantage of SQL is:

  • It is designed to be fault-tolerant, so even a client or PC crash should not lose any data (although I would make periodic backups).

  • You don't have to load everything into memory (and parse it) initially, which makes start-up quicker.

  • Since updates are done on-the-fly it isn't slow to save changes (like it would be to write a large state file).

  • You can always read the database offline for debugging or other purposes.

  • The same database can be shared easily between multiple worlds (eg. different characters on the same MUD) which isn't as easy with a state file.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]