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 7499597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:52:47+00:00 2026-05-29T19:52:47+00:00

what do you think would be performance-wise the better way to get the category-names

  • 0

what do you think would be performance-wise the better way to get the category-names of a news-system:

  1. add an extra field for the cat-names inside a table, which allreade contains a field for the cat-ids

  2. no extra field for the cat-names, but cat-ids and read in the cat-names (comma-seperated string: “cat1,cat2,cat3,cat4”) into the php-file by an existing config-file and then build the cat-names with the help of the db-field “cat-ids” an array and a for-loop?

Thanx in advance,

Jayden

edit: cant seem to add a “hi” or “hallo” on top of the post, the editor just deletes it…

  • 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. Editorial Team
    Editorial Team
    2026-05-29T19:52:50+00:00Added an answer on May 29, 2026 at 7:52 pm

    If you are measuring milliseconds and the disk IO of your system is not extremely slow, then option 2 would yield better performance. But, we are talking a negligible gain in execution time. Since you already will be querying the DB to get the news item it would be highly optimized to just get the category name at the same time. I would add a mapping table of category-name-id to category-names. And the join on that when getting news items.

    From a flexibility standpoint and the standpoint of eliminating as many possible sources of error I would also go with my above idea. Since it adds flexibility to your system and keeps all your data in one spot. Changing the name of a category would require editing one column i the database instead of editing a php config file or, if option 1 was used, updating each and every news record.

    So my best advise, add a table with category-name-id to category-names mappings and then have the news-items contain the id of the category they belong to.

    For performance you could then cache the data you retrieve about existing categories and other data so you don’t have to poll the DB for that information all the time.

    For instance. You could, instead of joining at all, get all the categories from the category table I described above. Cache it in the application and only get it once the cache is invalidated. i.e. a timeout occurs or the data in the db is manipulated.

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

Sidebar

Related Questions

What would be the most optimal algorithm (performance-wise) to calculate the number of divisors
I am struggling trying to perform what I would think would be a relatively
So I have this idea for a RubyGem that I think would be an
The following code is an example of what I think would qualify as pseudocode,
You would think that launching a bat file from Java would be an easy
I think it would be easier to use function pointers if I created a
I think it would be fun to model a top view of a train
So you think it would be easy to find a direct example of POST
I could never think it would be even challenging but is there any function
My problem is one that you would think is quite common, but I haven't

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.