mysql in clause vs multiple delete with one commit

I have about 100K records that I have to run for the following query:

delete from users where name in #{String}

where the string could be 100K strings of this form: Joe,Kate etc.

For performance is it better to run the above statement or delete one record in a loop with one session.commit(); in the end?

EDITED

There could be only one record for each value

Answers


If you can create batches of queries to run then breaking it up into batches would most likely be the fastest:

delete from users where name in ('name1','name2','name3',.....'nameX');

delete from users where name in ('nameX+1','nameX+2','nameX+3',.....'nameX+X');

etc..

If you have the names in a table already you can just do this:

delete from users where name in (select name from table_with_names_to_be_deleted)

Need Your Help

Decision Tree in R using rpart based on multiple splitting attributes

r prediction decision-tree

I am trying to build a decision tree for a prediction model on the following dataset:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.