long integer - exclude many users in mysql -
thank in advance help. have make exclusion of users, problem takes long (about 5 hours or more) in database have 800,000 users of exclude around 580000 users (i 220000 users not repeated).
- to make first method:
select iduser userstotal iduser not in( select iduser users220000)
(this simplified example of that's idea) takes 5 hours or more perform query.
i thinking of php script add in array of users , go excluding repeated.
that advise me optimize sql query or optimum method this.
- for reference use myisam
i rewrite query as
select ut.iduser userstotal ut not exists ( select u2.iduser users220000 u2 u2.iduser = ut.iduser )
and make sure iduser
of userstotal
table indexed.
i doubt index on users220000 make difference wouldn't hurt either.
edit
thanks ronnis spotting missing clause.
Comments
Post a Comment