English 中文(简体)
WHERE在电离层中的最大值
原标题:Maximum values possible in a WHERE IN query

I have a table with over 3000000 entries, and i need to delete 500000 of them with given ID s. My idea is to create a query like:

DELETE FROM TableName WHERE ID IN (id1, id2, ...........)

which I generate with a simple C# code. The question is: is there a limit to how many values I can set in the array of ID s.

如果有人能更好地实现这一删除,那么我就对想法持开放态度。

最佳回答

At the end my solution which works not so bad: 1. Sorted the ID s (to save server paging) 2. Created with C# code query s with 500 ID s in them. 3. sent the query s one by one.

我假定,当我与1 000+毫升的电梯服务器一道工作时,处理盘问的时间正在放慢(在你在舱面服务器上运行的所有电问都正在处理和优化之后)。

我希望能帮助某个人

问题回答

如果能够以任何比较(如<编码>WHERE ID < 1000000<>/code>)确定你的身份证,你可以

  1. INSERT them into a temp table with multiple inserts and then
  2. JOIN this temp table to yours

但插入可能会产生问题。 你们应该检查这一点。 你们怎样才能加快这项工作?

  1. make deletes in several bulks
  2. insert IDs into temp table in bulks




相关问题
Performance impact of indexed view in MS SQL Server 2008

Does anyone have experience with using indexed view in MS SQL Server 2008? I am trying to find out how does indexed view affect performance of insert / update statements, that are adding / updating ...

Lock Escalation - What s happening here?

While altering a table (removing a column) in SQL Server 2008, I clicked the Generate Change Script button and I noticed that the change script it generated drops the column, says "go" and then runs ...

Round to nearest 5 in SQL Server

I have a Money column in my SQL Server 2008 table. In my below query how can I round it to nearest 5$ select FineAmount from tickets Thanks

热门标签