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

  • Home
  • SEARCH
  • 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 6016845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:02:30+00:00 2026-05-23T03:02:30+00:00

I am making a site with a notification system, on every page load AJAX

  • 0

I am making a site with a notification system, on every page load AJAX is run to query a table in a database called notifications. I do not want to show the # of notifications one has, but only the type. There are 4 types. I currently have JSON just get UNIQUE of the type column and then do a check for each type.

Because this will be run many many times, I want to be sure it is well optimized. I am guessing one way would be to not run this check for new notifications someone has all 3 until they click on the notification bar (i.e. until they have a chance to clear one of them).

I was also wondering though if you think it would make a difference (positive or negative) for me to make the types each a prime#, and then multiply them together server-side, this way instead of sending 3 different ints I’m sending the product of 3 primes, then to check for each type I just mod(%) each type. I also want to know if you think it may make a difference but such a tiny one that I shouldn’t worry about it. I only worry because it will be run on every page load and don’t want users to feel the site is slow.

schema:

`notifications` 
(`id`,`from`,`to`,`type`,`optional_message`)
  • 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-23T03:02:31+00:00Added an answer on May 23, 2026 at 3:02 am

    I was also wondering though if you think it would make a difference (positive or negative) for me to make the types each a prime#, and then multiply them together serverside, this way instead of sending 3 different ints I’m sending the product of 3 primes, then to check for each type I just mod(%) each type. I also want to know if you think it may make a difference but such a tiny one that I shouldn’t worry about it.

    FFS! For some systems this kind of multiplexing is important – but it is usually implemented by ORing bit fields. But for HTTP, the amount of bandwidth this would save is ridiculously small. Don’t bother.

    If you really need to optimize this, the way to do it would be to cache the data serverside (MySQL will do this for you with a semi-intelligent algorithm).

    With four entities per key, denormalizing the data using a materialized view will not yield performance benefits unless te data is very skewed.

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

Sidebar

Related Questions

I am making use of AJAX on my site and I would like to
I've rewritten my family web site using JavaScript (JQuery) making Ajax calls to PHP
I'm reading through the Source Making site, specifically the Refactoring section. On the page
I'm making a site like StackOverflow in Rails but I'm not sure if it's
i am autpmating a web site that have different function page. i am making
im making a site that need to have random videos load on the front
I'm making some site which must be fully unicode. Database etc are working, i
I've been looking for ways of making my site load faster and one way
Im making a (small) site in php & mysql. The mysql database consists of
I am making a site that publishes articles in issues each month. It is

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.