Hi.
I think you should create an index like this.
alter table user add index idx_tmp (key1,key2,key3,user_id)
2009/6/19 Darryle Steplight
> Select user_id from user where key1=value and
> key2=value2 and key3=value2 GROUP BY user_id
>
> is faster than
>
>
> Select distinct user_id from user
Select user_id from user where key1=value and
key2=value2 and key3=value2 GROUP BY user_id
is faster than
Select distinct user_id from user where key1=value and
key2=value2 and key3=value2;
2009/6/18 周彦伟 :
> Hi,
>I have a sql :
>Select distinct user_id from user where
Please don't change the subject on someone else's thread. Next time, post a
new message instead of hitting "reply" on an unrelated message.
In the last episode (Jun 19):
> Hi,
> I have a sql :
> Select distinct user_id from user where key1=value and
> key2=value2 and key3=va
Hi,
I have a sql :
Select distinct user_id from user where key1=value and
key2=value2 and key3=value2;
I add index on (key1,key2,key3,user_id), this sql use temporary table
howevery
I have thousands of queries per second.
How to optimize it?
Anthoer question:
Select * fr