Partheey February 2016

Is it better to read a data from file or database?

In my application, the customer will be given a set of 5 choice based questions. Based on the answers, he will get an offer. The answer choices and offers are mapped in the following way.

[1,3,2,5,4] - Offer No.5,

[1,1,1,2,1] - Offer No.2

Totally some 30 mappings.

This is where i need a clarity. Should i store it in the application db or in a file ? Which is the best approach and why ?

Answers


freakish February 2016

Proper DB is almost always a better choice for multiple reasons:

  1. It solves issues that at the moment you are not even aware they exist but which you will face sooner or later (e.g. consistency, efficiency, atomicity, etc.).
  2. It allows easier scaling of app servers (if we are talking about dedicated db servers).
  3. It is easier to manage (e.g. indexes, CRUD queries, etc.). Don't reinvent the wheel, use fruits of others hard work.
  4. Can be easily extended at relatively low cost.

But if you don't necessarly think you will ever need multiple machines then sqlite is still a better choice then manual file handling.


Pokies February 2016

The file system needs parsing numbers, dates (records in DB's) and so on ... You should be aware that the contents of a txt file won't be indexed. But in DB, data can be indexed and you can query the database to get the results. So it's useful for management purposes. Another one is relational model, So data doesn't need to repeated over and over (which we know as redundancy in DBMS's)

So after all you should know that file System may be useful in some cases, But not all cases.

Post Status

Asked in February 2016
Viewed 3,818 times
Voted 7
Answered 2 times

Search




Leave an answer