?
Solved

Intelligent Date Time Search in Mysql

Posted on 2007-03-29
3
Medium Priority
?
681 Views
Last Modified: 2010-08-05
Scenario:
We have created an audit table to records certain relevant actions taken by users of our application. The table has a primary key as well as a date/time stamp field to store when an action is taken. The interface that we use to view the audit table allows the user to select a date range.  Say All Results between March 28 - 29 , 2007.

Question:
Will Mysql search the entire table to find values with those dates or is it smart enough to look only between the dates selected? Or is there a way to make it look at the entries between the dates selected?

Can someone point me in the right direction to allow me to gain a better understanding of how Msql works in relation to a date/time search.

Thanks
0
Comment
Question by:winbiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Assisted Solution

by:mukhtar2t
mukhtar2t earned 600 total points
ID: 18816302
You can index the date field so it will search just the selected period
0
 
LVL 4

Expert Comment

by:mukhtar2t
ID: 18816316
You can check http://mysql.com for documentaion of how date indexes work if you want
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 900 total points
ID: 18817488
the keyword is indeed INDEXes. only with INDEXes on the relevant columns, you can improve search performance on the fields you put conditions on (WHERE, JOIN ... )
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question