Re: RES: Mutiple SQL request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jônatas Zechim wrote:
> For example i’ve this query:
> 
>  
> 
> SELECT admin_nome FROM ctalk_admin WHERE admin_lastping <= '1233762658' AND
> admin_lastping >= '1233762608' AND admin_id='1'
> 
>  
> 
> I ran explain, the result for extra is ‘Impossible WHERE noticed after
> reading const table...’
> 
> How can i optimize this query?
> 
> Is there some tutorial on the net?
> 

I am going to guess that that admin_id column is already your primary key and therefor is unique and indexed by default.

I would add a compound index to ctalk_admin

ALTER TABLE `ctalk_admin` ADD INDEX (`admin_id`, `admin_lastping`)

or something along that line.

>  
> 
> Thanks, 
> 
> Zechim
> 
>  
> 
> De: Bastien Koert [mailto:phpster@xxxxxxxxx] 
> Enviada em: quarta-feira, 4 de fevereiro de 2009 12:46
> Para: Jônatas Zechim
> Cc: php-general@xxxxxxxxxxxxx
> Assunto: Re:  Mutiple SQL request
> 
>  
> 
>  
> 
> On Wed, Feb 4, 2009 at 9:43 AM, Jônatas Zechim <zechim.php@xxxxxxxxx> wrote:
> 
> Hi there, i've a system that do a query each 3s, does it impact on mysql
> Server?
> I mean, can this slow my Server?
> 
> zechim
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> It impacts system recources if this same query is run constantly for each
> user. Example: if this runs a logon and you have 100 or 1000 users logging
> on at roughly the same time, then you will have contention for the
> resources. 
> 
> Can you check your indeces and run explain plans on the queries to see if
> any of them can be optimised to run quicker?
> 


-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux