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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:32:10+00:00 2026-06-01T03:32:10+00:00

I am working on a PHP / MySQL stat logging program and am trying

  • 0

I am working on a PHP / MySQL stat logging program and am trying to find the best MySQL DB Structure for it.

There is a part where visitors will be able to see up to the date stats (i.e the latest 20 entries) but also will be able to see today’s overall, yesterday’s overall, last 7 days overall and last 30 days overall stats.

From the data I’m pulling the real-time stats will be updated every 60 seconds with at least 10 new entries per update.

Is my logic correct to setup two tables … one to act as “today’s” stats and another to act as the overall archive … like:

todays_stats
id
from_url
entry_date

overall_stats
id
from_url
entry_date

Then double insert for each new entry but truncate the todays_stats at midnight every night via a cron job?

Or is there a more efficient way of doing this?

  • 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-06-01T03:32:12+00:00Added an answer on June 1, 2026 at 3:32 am

    It depends on your daily stat row count, whether to delete historical data, and how much indexes you has. We need to delete historical data and has 7~8 indexes with large amount of stat data, so we separate data into daily tables and write stored procedures to fetch data(last day, last 7 day, last 30 day etc). Dropping table is much more faster than DELETE FROM table WHERE index=6-month-old-data

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

Sidebar

Related Questions

I am trying to get UTF-8 encoding working with CKEditor/PHP/MySQL/HTMLPurifier. I have converted the
I'm working with some existing PHP/MySQL code. I'm logging/tracking certain activities into a MySQL
I am used to working with PHp and MySQL, I an now trying to
I am working on building a small php/mysql script that will act something like
I'm trying to learn oop. I'm working with PHP-MySQL. And I have troubles about
I am working on a large php/mysql application, and I am getting to the
I am currently working on a small sponsorship application(PHP/MySql) for my personal blog, and
Im working on a website (html,css,javascript, ajax, php,mysql), and I want to restrict the
I am working on an issue management system, developed in PHP/MySQL. It requires search
I am currently working on a web application that uses PHP and MySQL, but

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.