Hi!
>>>>> "Heikki" == Heikki Tuuri <[EMAIL PROTECTED]> writes: Heikki> Rafa, Heikki> OR's are generally difficult to optimize. Heikki, this is true if you are using OR on different keys. MySQL can fully optimise the query when using OR on different key parts of the same key (which is the case for the used query:) Select Cod,Nom,Nif,Nombre_comercial from Clientes Where (Nom = 'GARCIA MANCILLA,S.L' And Cod>'061642') Or Nom>'GARCIA MANCILLA,S.L' Order by Nom ASC, Cod ASC Limit 50; In this case MySQL should start scanning the table from the key [(GARCIA MANCILLA),(061642)[ and continue until it has found 50 rows. Regards, Monty --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php