1. The first query was wrong, it should be
select id from atable where truncate(c1/1000000, 0) = 321
2. I cannot do a testing. Because I am running the database on a web
hoster's shared server. The testing time results are very different for the
same query. I cannot compare them.
3. I also want to know if there's any other faster way to do integer
division like the / in c. I am using truncate.
4. Because the server space is limited. I only can make necessary index. I
want to know if the index on c1 or c1/1000000 is helpful to speed.
I need some suggestion from someone has such experience. Thanks for any
help!
Best Regards,
Jin Hui
> -----Original Message-----
> From: Ed Carp [SMTP:erc@stripped]
> Sent: Monday, March 29, 1999 1:52 PM
> To: Jin Hui; mysql@stripped
> Subject: Re: Question about query
>
> >I have a query like
> >select id from atable where truncate(c1/1000000) = 321
> >
> >I learned that following query has the same function
> >select id from atable where c1 like '321______'
> >
> >I'd like to know which is faster. Or anyone know how to do integer
> division
> >in MySQL faster.
> >
> >And if I make a index on c1 or a index on c1/1000000, which index will
> >increase the query speed, or none index is helpful.
>
>
> I hate to be a curmudgeon (again) but wouldn't it be easier and faster to
> test it on your own machine than posting to a mailing list and essentially
> asking someone else to do your work for you?
>
> Indexing a field is generally always faster, but this depends on your
> application. Again, test it on your own machine with a big recordset and
> time it to see which is faster.
>
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread1121@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.