From: "Frank LIU" <[EMAIL PROTECTED]>

> I also did some other test:
> I ceated two tables both only have two columns, and both load 50000 rows.
> Talbe A has two int type columns,
> Table B has an int type as primary key, and a mediumblob column. I insert
a
> 4k data into blob column of each row.
>
> It turns out that the query:
>         select count(*) from A;        takes 0.19 sec
>         select count(*) from B;        takes 32 sec
>
> It looks like the query depend on the size of row.
> If the query is using index, the query should not make difference. What
can
> I do to improve the query speed?

here there are two things...
first of all, you are not using the index in table B since you're using *
and therefore it makes a full scan of the table

on the other hand when you use functions, indexes are deprecated, and you're
using the count() function
at least in Oracle it's like that...

In Oracle you can see how the query is done using EXPLAIN
I know MySQL has it's own EXPLAIN, but haven't tested it yet...

regards,

Juan



---------------------------------------------------------------------
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

Reply via email to