Author Topic: Need Bouce MySQL command to purge bounced records...  (Read 3992 times)

BGSWebDesign

  • Posts: 625
    • View Profile
    • http://www.bgswebdesign.com
Need Bouce MySQL command to purge bounced records...
« on: January 17, 2005, 01:16:28 pm »
Hi Dw and All,

Ok, it seems bouncing is working fine now, BUT, the only thing is there is no way to move the bounced records OUT of the database to a 'purged' or 'deleted' table or remove them completely from the  table to free up the space they are taking up.

Do you have a SQL command DW, or does anyone that would dump the bounced records to a text file (with sql commands similar to mysqldump) so that I can purge these bounced records?
Thanks,
-Brett
http://www.bgswebdesign.com/Contact-Us.php

*** I do custom List Mail Pro installations ***
Contact me through my website (above)

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Need Bouce MySQL command to purge bounced records...
« Reply #1 on: January 18, 2005, 04:44:01 pm »
Here's a command for removing all bounced users on list 1:

delete from lm_users where cnf = '3' and list = '1'

And for all lists:

delete from lm_users where cnf = '3'

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

BGSWebDesign

  • Posts: 625
    • View Profile
    • http://www.bgswebdesign.com
Need Bouce MySQL command to purge bounced records...
« Reply #2 on: March 14, 2005, 07:55:53 am »
Hi DW,

Just a quick followup on this, so I can keep track of what I did, and it may help others.

If you want to save your Bounced Users, which is probably useful, you can create another table 'lm_bounced' to store them in.  To create that table from the lm_users table use this command (NOTE: this only works for MySQL ver. 4.x and above, if you don't have 4.x or above, see below for creating without indexes):

Code: [Select]
CREATE TABLE lm_bounced LIKE lm_users;

If you don't want the indexes, which I don't care about, but maybe they are needed (DW?), are they needed to pull queries from, for example with the new Rule Based Sending coming in the next release, are indexes needed for that?   Also, how much space do the indexes eat up, andy idea?  Perhaps you can give the commands here needed to index the lm_users table DW?

Anyway, if you don't need indexes you can do this:
Code: [Select]
CREATE TABLE lm_bounced SELECT * FROM lm_users WHERE 1=2;

Since 1 <> 2 you will not get any records, but will get all of the correct fields setup.

Now, to copy the bounced records use this command:
Code: [Select]
INSERT INTO lm_bounced
SELECT *
FROM lm_users
WHERE cnf = '3'


This should tell you how many rows were copied, then you can delete the bounced users using the command:
Code: [Select]
delete from lm_users where cnf = '3'

Ok, that takes ALL of your bounced users and moves them to a new table lm_bounced, but you can also do it by list, if you wanted to, I don't have a need to, and this was good enough.
Thanks,
-Brett
http://www.bgswebdesign.com/Contact-Us.php

*** I do custom List Mail Pro installations ***
Contact me through my website (above)