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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:49:56+00:00 2026-05-12T21:49:56+00:00

Is there a preferred way? There are currently 1640 rows in the game table

  • 0

Is there a preferred way? There are currently 1640 rows in the game table to go through and will be adding about 1200 every year.

SELECT `date` FROM `game` WHERE `date`<'2009-11-09' ORDER BY `date` DESC LIMIT 1;

0.0004 seconds

SELECT MAX(`date`) AS `date` FROM `game` WHERE `date`<'2009-11-09' LIMIT 1;

0.0006 seconds

The speeds were for the first time this ran. Each time after was 0.0002 for each.

mySQL:
Server: Localhost via UNIX socket
Server version: 5.1.37

PHP (shouldn’t be relevant):
5.x

  • 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-12T21:49:57+00:00Added an answer on May 12, 2026 at 9:49 pm

    Apply MySQL EXPLAIN and check the query plans. The second example may well have a cleaner plan, which is nice as it looks cleaner to my eye. (Once you remove the limit.)

    A noddy test locally shows (no indexes).

    Query 1:

    EXPLAIN
    SELECT  datex
    FROM    TABLE_X x
    WHERE   datex < "2009-10-20"
    ORDER BY datex DESC
    LIMIT 1
    

    Plan

    id select_type table type possible_keys key  key_len ref  rows Extra
    1  SIMPLE      x     ALL  NULL          NULL NULL    NULL 2    Using where; Using filesort
    

    Query 2:

    EXPLAIN
    SELECT  MAX( datex )
    FROM    TABLE_X x
    WHERE   datex < "2009-10-20"
    

    Plan

    id  select_type table type  possible_keys   key     key_len ref   rows Extra
    1   SIMPLE      x     ALL   NULL            NULL    NULL    NULL  2    Using where
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a preferred way to handle animation when using Flex -- For instance,
Is there a preferred way to return multiple values from a C++ function? For
Is there a preferred (not ugly) way of outputting a list length as a
Is there a (or, do you have your own) preferred way to do background
Given two lists of equal length, is there a simpler or preferred way to
Is there a preferred algorithm for converting a 2-digit year into a 4-digit year?
Are there any open source libraries (any language, python/PHP preferred) that will tokenize/parse an
Is there a preferred way to detect when all of a QTreeWidgetItem 's children
What would the preferred way of programmatically determining which the currently installed version of
What is the preferred/easiest way to find the control that is currently receiving user

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.