Constants vs Database

Certified Lead Developer

Hi all,

I am developing an application that contains a questionnaire with around 20 questions. There are also around 10 sections to display help. 

Both questions and help can be updated by the users. 

I dont know if I should create 30 constants or store the data in the DB.

For performance reasons I think is better to use constants but for memory management and scalability I think the DB makes more sense.

Is there any recommendation about this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    To me, the next question is the most important to revealing the optimal solution.

    Will your questions be updated regularly, or very rarely?

    Regularly:  Use a database call.  Query the database every time, and save your updates to the database every time.

    Very Rarely:  For the sake of sparing your users and the bandwidth to the DB, it's much, much faster to query a constant.  You can have the users update the constant, which will add negligible time to the update process, but spare the examine process, which will net you far greater savings than losses, but only if the updates are very rare.  Keep in mind also that all versions of a Constant get saved somewhere.  So you will continue to add to your memory footprint very slowly as you update.

Reply
  • 0
    Certified Lead Developer

    To me, the next question is the most important to revealing the optimal solution.

    Will your questions be updated regularly, or very rarely?

    Regularly:  Use a database call.  Query the database every time, and save your updates to the database every time.

    Very Rarely:  For the sake of sparing your users and the bandwidth to the DB, it's much, much faster to query a constant.  You can have the users update the constant, which will add negligible time to the update process, but spare the examine process, which will net you far greater savings than losses, but only if the updates are very rare.  Keep in mind also that all versions of a Constant get saved somewhere.  So you will continue to add to your memory footprint very slowly as you update.

Children
No Data