On 04/10/2005, Jasper Bryant-Greene wrote:

> Kishore Jalleda wrote:
> > Could you kindly advice if this query can be made to run faster
> > SELECT title, template
> > FROM template
> > WHERE templateid IN
> > (608,2072,2073,1888,1898,1895,1897,1894,1896,1901,1903,1889,1900,189
> > 0,1891,1902,1904,2104,624,625,2152,2212,1985,1996,614,1964,2103,2106
> > ,2113,1982,1983,1984,2074,623,2117,2124,2123,2122,2119,2121); There
> > is an index on templateid also this query takes ~ 0.04xx seconds to
> > run I would like it to be in 0.00xx range explain select gives this
> > id select_type table type possible_keys key key_len ref rows Extra
> > 1 SIMPLE template range PRIMARY PRIMARY 4 NULL 40 Using where
> 
> It's using a primary key and only examining the 40 rows which you
> asked for, so that's about as optimised as you'll get for that query.
> You could always make the actual server faster...

If your template table contains many columns in addition to templateid,
title and template, and title and template are not TEXT columns, you
can consider a covering index on templateid, title and template:

ALTER TABLE template ADD UNIQUE (templateid, title, template);


-- 
felix

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to