mysql psuedo delete

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

mysql psuedo delete

Post by s.dot »

Is it possible to run a delete query without actually deleting the rows? Like just have MySQL tell me which rows were to be deleted if I ran it.

Of course I can run a select with the same where clause to see which rows will be deleted, but I want to ensure the delete query matches.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: mysql psuedo delete

Post by John Cartwright »

You could write your own transaction script that temporarily stores the results in memory, delete the results, make sure they match, if not restore the results from memory.

:crazy:
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: mysql psuedo delete

Post by Kieran Huggins »

just do a "SELECT id FROM" instead of a "DELETE FROM"

optionally, you could use a transaction and roll it back, though I'm not sure that would tell you WHICH rows are deleted.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: mysql psuedo delete

Post by aceconcepts »

Can't remember exactly how I used it but I have used "ON DELETE" in the past - thought it might be worth looking into.

Forgive me if it's got nothing to do with it :D
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: mysql psuedo delete

Post by s.dot »

Jcart wrote:You could write your own transaction script that temporarily stores the results in memory, delete the results, make sure they match, if not restore the results from memory.

:crazy:
LOL thanks for the crazy emoticon. That was funny LOL
It does seem a bit crazy actually.

But I am dealing with a large (about 1.5M rows) table, and that kinda makes me feel :crazy:
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply