On Apr 22, Philippe Poelvoorde wrote: > alter table s add index(login_name); > alter table c add index(recordID);
To make this much faster, I think you may want: alter table s add index(recordID, login_name); alter table c add index(recordID); Because after the join, the engine can use the two-key index to filter the results. I may be wrong about this though -- I haven't tried it. A > 2006/4/22, abhishek jain <[EMAIL PROTECTED]>: > > Dear Friends, > > I have two table joined by the followng query, the problem is this simple > > query takes a lot of time greater than 10 mins depending on the number of > > records, Pl. help me find out the reason: > > Table 1: > > id_key primary and auto increment > > recordID varchar(100) > > login_name varchar(255) > > blah > > blah > > > > > > Table 2: > > id_key primary and auto increment > > recordID varchar(100) > > blah > > blah > > > > > > Query: > > SELECT count( * ) FROM table1 s, table2 c WHERE s.login_name = 'abhishek' > > and s.recordID=c.recordID; > > > > Do you it recordID to be a varchar ? > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]