Jump to content

How can I ensure that a text file being accessed and updated by numerous people doesn't become corrupt?


Recommended Posts

I'm thinking of creating a  text file of a database to be used instead of multiple queries.

 

This idea isn't mine originally, just thought it could be a better option

 

First: Let's say we have a 1000 users

 

What is better:

 

1) A text file to be accessed 1000 times, being broken up for the parts eg. user, text posted, date, etc...

2) The same data in the database accessed 1000 times but faster search

 

or are they pretty much the same thing? data stored somewhere

My concern... so far my thought of action is that every time a page that uses this text file is loaded, the current text file is loaded and then the same text file is updated.

Meanwhile, if people write to the file, it can be updated as well while it is being used, I would think I should have at least two, but then I would think that's not enough, this could become a lot... so what plan should I go down?

 

Is this a silly concern?

What is the better way to solve this problem of a database being displayed and updated. Seems like an everyday thing. Just wondering the savings from using a text file or just use the database.

Edited by moose-en-a-gant

The database is going to perform better by leaps and bounds. After all, that is exactly what it is for. It has mechanisms for optimized queries, caching, indexing, better resource management, etc.

Okay I'll go with that

 

Until I get more experience and start tracking / observing the resource use for my specific application / page design

 

Thanks

Edited by moose-en-a-gant
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.