Aren't date fields stored as long integers?  But then again, taking out the 
time part of a datestamp would go a long way in terms of storage and cpu use.

I do have a question with regards to MySQL's query optimizer.  In Roger's item 
#3, will MySQL compute the value of unix_timestamp() only once for the query?


--- mike t.


----- Original Message ----
From: Roger Filomeno <[EMAIL PROTECTED]>
To: Philippine Linux Users' Group (PLUG) Technical Discussion List 
<[email protected]>
Sent: Thursday, January 17, 2008 6:12:24 PM
Subject: Re: [plug] Large MySQL table

Extreme solution:

1. change date field from datetime or timestamp to int type equivalent. Warning 
do not use alter table, data will be lost; make a script to re create the date 
data as int using unix_timestamp instead.


2. index the field.

3. rewrite sql as select id,datedue from table1 where datedue > 
unix_timestamp("2006-01-01 01:01:01") .

 avoid use of select *, if possible get only the data you need




_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph

Reply via email to