MySQL Forums
Forum List  »  Newbie

Re: SELECT took lengthy of time
Posted by: Man Fan
Date: August 28, 2010 05:42AM

Hi,

1)
The query
select *
from stationlog
where airdate >= '2010-03-01' and airdate >= '2010-03-31'

returned ~50000 records.

However, this is just one of the selects, I might need

Sometime I need to query for a year:
eg.
select *
from stationlog
where airdate >= '2009-03-01' and airdate >= '2010-03-31'

This is for using in the report.

2)
In addition, I need to do a join with other tables:
The query
select sl.*, e.EmployeeName, c.CityName, ...etc
from stationlog sl
left join city c ON c.CityCode = sl.CityCode
left join employee e ON e.EmployeeID = sl.EmployeeID
where sl.airdate >= '2010-03-01' and sl.airdate >= '2010-03-31'

3)
Yes, as I use a OPF in Delphi generating the primary using GUID, ie strip off the open and close braces.
The OPF people recommended me to use GUID to generate the primary key rather than using auto-increment.


4)
The other tables query seems OK.
The problem normally happened in the report generating because the user may request a yearly report so the query needs to query a year-long records.

Options: ReplyQuote


Subject
Written By
Posted
August 23, 2010 07:23PM
August 23, 2010 09:51PM
August 24, 2010 09:26PM
August 26, 2010 07:05PM
August 26, 2010 10:05PM
Re: SELECT took lengthy of time
August 28, 2010 05:42AM
August 29, 2010 10:20PM
August 23, 2010 11:56PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.