Jump to content

question regarding SQL database vs. text file


Notretsam

Recommended Posts

This isn't a question on any problems using SQL but is related to SQL.

 

Am more wondering about the setup side here and decided to post here, an see what others think but could just be a case of me over thinking things.

 

Am making a text based wrestling game and I store information related too matches in mysql databases.

 

There is basically 3 database tables used to store the information

  1. Match Information: players stats and other such information (only one row of info for each match)
  2. Match Chat: all chat in a match stored in this table
  3. Match History: all the text info that shows if player landed the wrestling move successfully or not.

My concern is more with the match history database table, I don't expect much chat in matches but is possible.

 

Am concerned about potential lag with the history added to the one database table, we talking about a lot of matches potentially done daily.

 

Even though processing of getting information is really fast, I believe the SQL query still loops through the database table until it finds a match. So am thinking, the more information added to database table, the slower it become and eventually there could be issues with lag.

 

so wondering the following

  1. Am I just over thinking here and SQL be fine, and I never run into lag issues?
  2. Should I just use text files to store the history and chat, create text file when match first setup , so each match have its own text file.

 

FYI. I not too familiar with the actual inner working of SQL with the web server, pay my hosting company to do that and I always use phpmyadmin to setup sql tables.

 

 

 

  • Like 1
Link to comment
Share on other sites

There are too many unknowns in your vague question. Your server-side code can measure and record the execution time of every database query and every file access. You can monitor those results and decide for yourself.

Link to comment
Share on other sites

what is vague about my question?

 

in a database table that potentially going have large amounts of information added to it, would I run into lag issues and therefore be better off using text files?

 

am perfectly aware i can record the execution time , but am asking about the future and therefore trying to anticipate if this will be a potential problem.

Link to comment
Share on other sites

If you intend to sort the data, load multiple records at a time or search for data matching certain criteria you're much better off using a database than storing the data in a text file. If you expect to have thousands of records and your program is going to be reading the data frequently then you definitely are better off with a database.

 

Databases are optimized for handling large amounts of data. If you stored it in a file which is loaded and manipulated with every visitor on your site then you're going to have problems with file locking, overloading the memory and limitations with file size.

Link to comment
Share on other sites

the choices

 

1) two text files created for each match and match history and chat stored in them, so only data in text file would be for the match being viewed.

 

or

 

2) 2 SQL databases with match history and match chat, but all match history/chat data in the SQL databases tables, but using match id column in SQL database to get correct information to show in match.

 

right now its setup with option 2, just concerned in future I run into lag issues with SQL.

 

going by you're last part of post Foxy, I think am right on doing it with SQL and not text files. just wanted to come on here and clarify best way to do it, an make sure before say a years time I run into lag issues.

Edited by Notretsam
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...