I'm tried to delete contacts group (basically entire contacts from the particular group), getting Gateway timed out error and only few contacts are getting deleted.

So I'm planning to delete contacts from the database. It quite complicated, customer details are stored in different tables.

If I go through the database approach what all the tables I need to join to get all contacts deleted from a group?

  • Are you trying to remove the contacts from a group, or delete the actual contacts?
    – Aidan
    Commented Aug 31, 2018 at 8:28
  • Deleting actual contacts. Not removing contacts from the group.
    – Ashwin
    Commented Aug 31, 2018 at 8:34
  • 1
    Try increasing max execution time in php.ini rather than going for hardcoded deletion from database. Commented Aug 31, 2018 at 8:40
  • - and if you can't change php.ini, try deleting the contacts in smaller batches.
    – Aidan
    Commented Aug 31, 2018 at 8:44

1 Answer 1


It's strongly recommended NOT to delete data directly via SQL. I don't think it's possible to say which tables you need to delete from - there are hundreds of tables, not including those added by extensions, and it's impossible for us to know which are in use for you.

Instead, consider the suggestions by Jitendra and Aidan above - the issue is that the server is misconfigured. Alternatively, consider using the API. Especially if done from the command line where there should be no max_execution_time set, this should resolve your issue much more cleanly without causing orphan database records.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.