Shoutbox

MySQL vs Text Files - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: MySQL vs Text Files (/showthread.php?tid=91347)

MySQL vs Text Files by stoshrocket on 07-05-2009 at 11:20 PM

I was coding earlier today and it just struck me that I never use MySQL databases... I've got nothing against them, hell, I know nothing about them really, but this has been purely out of need. The reason I learn something is because I need to, I learn to use different functions because I need to use them etc, and quite frankly, I've never really had a need for utilising a database: I've always just manipulated text files to get the job done.

The question I pose is what would you consider the advantages and disadvantages of text files or databases?

(and yes, I have quickly google'd, I'm asking for more of an "opinion laced with fact" answer than a google query :dodgy:)


RE: MySQL vs Text Files by CookieRevised on 07-05-2009 at 11:43 PM

It all depends on what you mean with manipulating textfiles and what you use them for, exactly...

In other words: both have advantages and disadvantages. Without knowing what you exactly want, there is no way to give you any advise or list the advantages.

;)

In extremely short, without having the essential information of what you want it for:

Databases are good for stuff which you can order in tables and which might have raltionships in other tables and for things you need to read and save out of order and for a massive amount of data.

Text files are good for stuff like logs and other data which is mostly saved (and read) in sequential order. They are also very easly maintained.


RE: MySQL vs Text Files by prashker on 07-05-2009 at 11:47 PM

My "Last Played" uses MySQL, while as the sig here uses Text to log.

I guess you want MySQL for search stuff with SQL queries, and text files for easier things....lol


RE: MySQL vs Text Files by Jarrod on 07-06-2009 at 12:14 AM

Well I don't use mysql because I don't like programming php, I prefer to program python and sqlite3 is native to > python 2.4.
however since mysql and sqlite3 are very similar my points are still valid

think of an sql table like a table in excel, each column labeled
for example

code:
userID        username        reputation        dateJoined        posts        website

1            Jarrod            10                10/3/2009        666            google.com
2            fred                8                5/6/2009        5            yellowpages.com


so say you table looks like that; it's not to hard to use a csv file to store the same information,
but take this query
you want all the users who's reputation => 10
in python
python code:
def get_record():
for item in open('users.txt').readlines():
  if item[2] => 10:
   return item
now using sqlite
python code:
import sqlite3 as sql
dbname="Users"
con=sql.connect("%s.db"%dbname,isolation_level=None)
cur=con.cursor()
print cur.execute("SELECT * FROM Users WHERE reputation => 10")
now that won't work completely it will be buggy cos I didn't test it but the idea is that you don't need to write in iterations and such the sql does most of that for you


RE: MySQL vs Text Files by absorbation on 07-06-2009 at 12:03 PM

MySQL is quicker and a more efficient way to manage and organize data. It's pretty easy to use and I argue is significantly more simpler than manipulating text files.


RE: MySQL vs Text Files by CookieRevised on 07-06-2009 at 12:24 PM

quote:
Originally posted by absorbation
MySQL is quicker and a more efficient way to manage and organize data. It's pretty easy to use and I argue is significantly more simpler than manipulating text files.
That completely depends on what you exactly want to do!!!
Text files can be a lot easier, smaller and faster in some cases...
RE: MySQL vs Text Files by davidpolitis on 07-06-2009 at 01:05 PM

It all depends on what you're doing. There's no point in using a database if you're just storing some simple information. Queries can take a while to process. If you're making a news system then SQL would be useful for having news categories and/or a news search feature. I'm sure there are a lot more cases in which SQL would be convenient since SQL queries are hell easy to perform through PHP.


RE: MySQL vs Text Files by stoshrocket on 07-06-2009 at 06:23 PM

Cool... I can see the advantage of using MySQL, I might have a play around with it this week, see about converting a couple of old projects to mySQL. I have quite a few projects that looking over it would be greatly optimised using MySQL methinks...

Thanks for the opinions and comments.


RE: MySQL vs Text Files by RaceProUK on 07-08-2009 at 05:29 PM

quote:
Originally posted by Jarrod
Well I don't use mysql because I don't like programming php, I prefer to program python
I'm pretty sure there are MySQL bindings for Python ;)