Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 86187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:12:24+00:00 2026-05-10T22:12:24+00:00

This follows on from this question where I was getting a few answers assuming

  • 0

This follows on from this question where I was getting a few answers assuming I was using files for storing my HTML templates.

Before recently I’ve always saved ‘compiled’ templates as html files in a directory (above the root). My templates usually have two types of variable – ‘static’ variables which are not replaced on every usage but are used across the site – basically for ease of maintenanceif I decide to change the site name for example; and dynamic vars that change on every page load.

I always used to save these as files on the server – but my friend pointed out something I’d overlooked: why have 5-10 filesystem calls when you can have one database call?

What I want to know is which is more efficient? Calling several HTML files from the system or calling several rows of templates from the database (in one query/call).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:12:25+00:00Added an answer on May 10, 2026 at 10:12 pm

    Don’t Store Editable HTML In the database

    Seriously, because the maintenance overhead for mere changes becomes exhaustive once you realise you can no longer just pop open a text editor.

    I worked on many projects which had HTML content in the database, and it was a constant nightmare of ‘find that row the content is on’ and I really would liked to have shot the person whom made it.

    Also, DON’T PREMATURELY OPTIMISE . If you find it a problem thats slowing the project down, then change it. Because making the code exhaustively less maintainable to save a millisecond. But design the code well enough that should you need to change where the content comes from later it should be easy to do.

    Surely that can be resolved by having a suitable web interface for editing the templates?

    Erm, really not, unless you’re only trying to compete with notepad. Syntax highlighting and all the other full host of features you can get in a standard editor just make your developers suicidal when they find themselves editing web pages by hacking at an undersized text area with awful white on black ( not to mention the extra fun you get with having to worry about entity encoding etc, for instance, try editing html with in a text area where the html content contains a text area element! )

    On FileIO

    While File IO can be a bottleneck, keep in mind that if you have a proper linux install, and plenty of memory, a handy thing known as ‘disk-cache’ takes effect, which in effect, keeps files used in memory, so file IO becomes mere memcpy.

    On the contrary, in real stress tests on any of the code I have used, the biggest slowdowns have been in the database!, primarily the nice slow CONNECT string, query parse time, extra php<->mysql interactions. You’re not really looking at gaining anything. Filesystem lookup is close to database index lookup, and you don’t have any unknowns other than ‘you need to stream it from a disk’, no table locking stuff to worry about!

    You should probably try something like a caching library, X-Cache comes highly recommended, thats more likely to give you visible performance gains.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Does your review model have the corresponding belongs_to :user belongs_to… May 11, 2026 at 1:59 pm
  • added an answer Without further information regarding the structure of the tables, I… May 11, 2026 at 1:59 pm
  • added an answer try using query = query.OrderBy(c => c.FirstName); or var sortedQuery… May 11, 2026 at 1:59 pm

Related Questions

This question follows on from this vim search question I have a setting in
this kind of follows on from another question of mine. Basically, once I have
OK, this kind of follows on from my previous question . What I would
This is a follow on question to How do I delete 1 file from
I am creating a script on the fly to ftp some files from a
I'll be using the AdventureWorks Database to illustrate my problem. I need to show
This is a follow up on another problem i had with getting-the-last-record-inserted-into-a-select-query I am
My dad called me today and said people going to his website were getting

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.