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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:11:18+00:00 2026-05-22T03:11:18+00:00

I have a table being constantly inserted to with various usernames. I have a

  • 0

I have a table being constantly inserted to with various usernames. I have a page a user can load which shows the most recent entry in the database that was posted by them.

An example of the query I’m using: SELECT timestamp FROM entry_list WHERE username=’user’ ORDER BY entry_id DESC LIMIT 1

There is a 2-column index in the table: username, timestamp . This index is being used according to the EXPLAIN query, with the following additional information:

select_type: SIMPLE
type: ref
key_len: 34
ref: const
rows: 5654
Extra: Using where; Using index; Using filesort

How can I optimize my query? It’s fairly fast for a single user (0.2~0.4 sec), but some accounts load this information for 5, 10, or even 20 different users at once. Even 0.2~0.4 seems a bit long, and when it ends up slowing page load down by 4-8 seconds, it’s unacceptable.

  • 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-22T03:11:19+00:00Added an answer on May 22, 2026 at 3:11 am

    Try SELECT MAX(timestamp) FROM entry_list WHERE username = 'user'

    also, probably not the best idea to use reserved keywords as column names, try changing timestamp to insert_date or something like that

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

Sidebar

Related Questions

I have a MySQL table with about 5,000,000 rows that are being constantly updated
I have table rows of data in html being filled from a CGI application.
I have a table with the only relevant column being completionDate, a number of
I have a table of 3-4 columns, the central one being task names that
I have an HTML table with one column being email addresses; spambot issues aside,
I have an html table containing values that are being generated from javascript. How
I have to add some enum options to a database table. The problem being,
I have table, which I am inserting records to another table. What is the
I have a table being pulled from MySql through PHP.. The TD in the
I have two tables, records are being continuously inserted to these tables from outside

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.