LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-20-2003, 03:06 PM   #1
BlackT
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandriva LE 2005
Posts: 18

Rep: Reputation: 0
C++ question: MySQL or XML?


Hi there,

I want to make a program using C++, which stores/uses a lot of data. What is the best choice to store this data: MySQL (PostgreSQL) db or XML files? Which choice uses more CPU & memory?

Thanks in advance!
 
Old 07-20-2003, 06:02 PM   #2
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Depends what you want to do with the data I guess. Any more details? Speed of access important? Things like that.
 
Old 07-21-2003, 01:21 AM   #3
BlackT
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandriva LE 2005
Posts: 18

Original Poster
Rep: Reputation: 0
What I want to do with the data is not important...the most important thing is to choose the option which is the less CPU & RAM "killer"...
 
Old 07-21-2003, 03:51 AM   #4
nakkaya
Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Rep: Reputation: 45
if you use xml cpu and ram usage depend on your programming skillz but if you use mysql cpu and ram usage depends on the mysql programmers and if you use xml it is going to be pain in the ass to maintain file like you need to lock the files while writing them then you have to release them or other cant write them in my opinin you shoul use a rdms like mysql and mysql has a c++ api
 
Old 07-21-2003, 04:49 AM   #5
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
Quote:
What I want to do with the data is not important...the most important thing is to choose the option which is the less CPU & RAM "killer"...
as pround said we cant really advise you without knowing more details like:

how many simultaneous accesses?
from different machines?
what sort of searches will you do?
size?
security?
etc...

a database of application settings would be fine in xml because your only doing simple key=value searches and no bulk replacement.

a database of video rentals is a bit more tricky in xml because searches like which sci-fi moves are rented to people who signed up last month would be a processor killer.

both of the examples have a lot of data so we really need to know more than what you said initially.
 
Old 07-21-2003, 04:57 AM   #6
BlackT
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandriva LE 2005
Posts: 18

Original Poster
Rep: Reputation: 0
Ok, some more details:
What I want to do it's a little online TBS game. The players are making their "moves", stored in XML files or MySQL db. Every 1 hour, this little C++ program I want to make, will modify the players game-data according to their "moves".
Using a shared hosting, I want to make the right choice, so I won't "kill" the server with my application => my account suspended.

Well, I think the details are enough...Some advices?

Thanks again!
 
Old 07-21-2003, 07:31 AM   #7
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 50
if the server already runs an sql style database then i think that will be better than xml. i dont see how the c++ program gets the players moves and i doubt a shared server will allow you to run your own daemons anyway.
 
Old 07-21-2003, 07:46 AM   #8
BlackT
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandriva LE 2005
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by kev82
if the server already runs an sql style database then i think that will be better than xml. i dont see how the c++ program gets the players moves and i doubt a shared server will allow you to run your own daemons anyway.


That program won't run as a daemon...using a cron job, it will run once per hour.
The player moves are "managed" by an html interface, backended by PHP && (MySQL || XML).

I think I'll go with MySQL...thanks everyone for your answers!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL to XML - charset problems Boby Programming 1 04-20-2005 08:22 AM
experiences with embedded mysql? XML instead of a database? SerfurJ Programming 2 12-11-2004 08:06 AM
XML <->MySql in Perl?? rsz Programming 0 10-06-2004 09:40 AM
html, xml, php, mysql atheist Programming 8 06-07-2004 01:28 PM
MySQL: Importing a database from an XML file concoran General 0 09-08-2003 02:58 AM


All times are GMT -5. The time now is 08:32 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration