mysql - Limit deleted records when DELETEing w/Using -
i'm normalizing database moving several columns own tables , using foreign keys instead. i'm trying update queries in app use joins possible. in queries delete data, i'd prefer not lookup key values , run delete joins. method i've found works, adding using query - breaks use of limit clause.
delete prism_data using prism_data inner join prism_players p on p.player_id = prism_data.player_id inner join prism_actions on a.action_id = prism_data.action_id (a.action = 'water-flow') limit 5000; <--- ok before using/joins added i'm trying delete in batches of 5,000. how can modify query limit still valid?
unfortunately, according doc, limit clause valid single table delete:
single-table syntax:
delete [low_priority] [quick] [ignore] tbl_name [where where_condition] [order ...] [limit row_count]multiple-table syntax:
delete [low_priority] [quick] [ignore] tbl_name[.*] [, tbl_name[.*]] ... table_references [where where_condition]or:
delete [low_priority] [quick] [ignore] tbl_name[.*] [, tbl_name[.*]] ... using table_references [where where_condition]
http://dev.mysql.com/doc/refman/5.0/en/delete.html
on other hand, sub-queries allowed. maybe refactor query following form?
delete prism_data .... in (select ....) limit 5000
Comments
Post a Comment