sql - Speed up very slow query -


I am trying to delete the old records from the old SQLite3 database to 30,000 old records.
I'm using this question to remove:

  remove items from items ITEMS_ID IN (SELECT ITEMS_ID) with objects where the last time is not like '2014%' And do not like '2013%' and finally '2012%' and ITEMS_ID! = 1 and ITEMS_ID! = 4); The problem is that I have seen that this query is very slow or better, it is so slow that it takes ages and I have to stop it because it seems stuck.  

I think the problem is that IN () within SELECT statement is being repeated for each row repeated

< P> How can I fix this query? Before heavy deletion, make sure there are no triggers behind the curtains, which are < Code> delete
statement can be quite slow.

I do not think it is possible to temporarily disable triggers in SQLite because it is in other DBMSs. Therefore, you have to do this:

  1. Delete Trigger Script
  2. Drop Dump Triggers
  3. Run Delete Question
  4. Rebuild the trigger to be removed

Also, try to understand what these triggers are being removed, before disabling them. They can do some important, such data auditing or significant changes to maintain data integrity In this case, there may be anything to wait for some patience to wait and wait for a while.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -