Re: [PHP] Speeding up a Mysql Select

2002-10-09 Thread Marco Tabini

Also, probably a stupid question, but, is the `begintime` column
indexed? If it isn't, no matter what you do, the whole thing will keep
getting slower at an alarmingly fast pace :)


Marco


On Wed, 2002-10-09 at 07:14, Maurits Lawende wrote:
> You should include a LIMIT to the sql-query or mysql parses the whole 
> database
> 
> example:
> 
> SELECT * FROM `support` WHERE `begintime` > 'timestamp1' AND
> `begintime` < 'timestamp2' LIMIT 0,1';
> 
> 
> 
> John W. Holmes wrote:
> 
> >>I'm doing a select on a database that has about 45000 records and
> >>
> >>
> >growing
> >  
> >
> >>and its a bit SLOW.
> >>
> >>Its using a unix timestand to mark the beginning of a call and the end
> >>
> >>
> >of
> >  
> >
> >>a
> >>call.  This is also used so I know what date the call was received.
> >>
> >>When I do a
> >>
> >>select * from support where begintime between 'timestamp1' and
> >>'timestamp2';
> >>
> >>It takes a while to execute...  The timestamp fieldtype is
> >>
> >>
> >varchar(10)...
> >  
> >
> >>Will I see any speed difference with a different column type?
> >>
> >>Any advice on how to speed this up would be greatly appreciated! :)
> >>
> >>
> >
> >It would probably help to make it an INT column, since that's what
> >timestamps are and then index the column. Also, I've heard that it's
> >faster to use "begintime > timestamp1 and begintime < timestamp2"
> >instead of BETWEEN. It's probably minor, though, compared to the
> >advantage you'll get from an indexed INT column.
> >
> >---John Holmes...
> >
> >
> >
> >  
> >
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Speeding up a Mysql Select

2002-10-09 Thread Maurits Lawende

You should include a LIMIT to the sql-query or mysql parses the whole 
database

example:

SELECT * FROM `support` WHERE `begintime` > 'timestamp1' AND
`begintime` < 'timestamp2' LIMIT 0,1';



John W. Holmes wrote:

>>I'm doing a select on a database that has about 45000 records and
>>
>>
>growing
>  
>
>>and its a bit SLOW.
>>
>>Its using a unix timestand to mark the beginning of a call and the end
>>
>>
>of
>  
>
>>a
>>call.  This is also used so I know what date the call was received.
>>
>>When I do a
>>
>>select * from support where begintime between 'timestamp1' and
>>'timestamp2';
>>
>>It takes a while to execute...  The timestamp fieldtype is
>>
>>
>varchar(10)...
>  
>
>>Will I see any speed difference with a different column type?
>>
>>Any advice on how to speed this up would be greatly appreciated! :)
>>
>>
>
>It would probably help to make it an INT column, since that's what
>timestamps are and then index the column. Also, I've heard that it's
>faster to use "begintime > timestamp1 and begintime < timestamp2"
>instead of BETWEEN. It's probably minor, though, compared to the
>advantage you'll get from an indexed INT column.
>
>---John Holmes...
>
>
>
>  
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Speeding up a Mysql Select

2002-10-09 Thread John W. Holmes

> I'm doing a select on a database that has about 45000 records and
growing
> and its a bit SLOW.
> 
> Its using a unix timestand to mark the beginning of a call and the end
of
> a
> call.  This is also used so I know what date the call was received.
> 
> When I do a
> 
> select * from support where begintime between 'timestamp1' and
> 'timestamp2';
> 
> It takes a while to execute...  The timestamp fieldtype is
varchar(10)...
> Will I see any speed difference with a different column type?
> 
> Any advice on how to speed this up would be greatly appreciated! :)

It would probably help to make it an INT column, since that's what
timestamps are and then index the column. Also, I've heard that it's
faster to use "begintime > timestamp1 and begintime < timestamp2"
instead of BETWEEN. It's probably minor, though, compared to the
advantage you'll get from an indexed INT column.

---John Holmes...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Speeding up a Mysql Select

2002-10-08 Thread Bob Irwin

G'day,

I'm doing a select on a database that has about 45000 records and growing
and its a bit SLOW.

Its using a unix timestand to mark the beginning of a call and the end of a
call.  This is also used so I know what date the call was received.

When I do a

select * from support where begintime between 'timestamp1' and 'timestamp2';

It takes a while to execute...  The timestamp fieldtype is varchar(10)...
Will I see any speed difference with a different column type?

Any advice on how to speed this up would be greatly appreciated! :)

Best Regards
Bob Irwin
Server Admin & Web Programmer
Planet Netcom



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php