What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » MySQL vs Text Files

MySQL vs Text Files
Author: Message:
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
33 / Male / Flag
Joined: Aug 2005
O.P. MySQL vs Text Files
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:)
formerly methos
07-05-2009 11:20 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: MySQL vs Text Files
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.

This post was edited on 07-05-2009 at 11:47 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-05-2009 11:43 PM
Profile PM Find Quote Report
prashker
Veteran Member
*****


Posts: 5109
Reputation: 104
– / Male / –
Joined: Mar 2005
Status: Away
RE: MySQL vs Text Files
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
07-05-2009 11:47 PM
Profile PM Find Quote Report
Jarrod
Veteran Member
*****

Avatar
woot simpson

Posts: 1304
Reputation: 20
– / Male / Flag
Joined: Sep 2006
RE: MySQL vs Text Files
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


[Image: 5344.png]
[Image: sig.png]

A.k.a. The Glad Falconer














07-06-2009 12:14 AM
Profile E-Mail PM Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
RE: MySQL vs Text Files
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.
07-06-2009 12:03 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: MySQL vs Text Files
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...
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-06-2009 12:24 PM
Profile PM Find Quote Report
davidpolitis
Full Member
***


Posts: 371
Reputation: 16
Joined: Aug 2006
RE: MySQL vs Text Files
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.

This post was edited on 07-06-2009 at 01:07 PM by davidpolitis.
07-06-2009 01:05 PM
Profile PM Find Quote Report
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
33 / Male / Flag
Joined: Aug 2005
O.P. RE: MySQL vs Text Files
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.
formerly methos
07-06-2009 06:23 PM
Profile PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: MySQL vs Text Files
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 ;)
[Image: spartaafk.png]
07-08-2009 05:29 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On