Answers.Body: <p>Try the civicrm_mailing_recipients table - mailing_id tells you which Mailing they relate to. Is that what you are after?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-07T20:22:07.563Z
Answers.Text: What does id refer to in that table?
Answers.UserDisplayName: Mohit Agarwal
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-08T02:28:37.627Z
Answers.Text: just the row id for that table
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-08T09:58:07.003Z
Answers.Text: Using just the civicrm_mailing_recipients table, I get to know which email_ids belong to a particular mailing. But civicrm_mailing_event_delivered table does not contain the email ids, rather it stores information about event_queue_id. This means I would have to do join of 3 tables - civicrm_mailing_event_delivered, civicrm_mailing_recipients and civicrm_mailing_event_queue in order to find which all timestamps (of delivered mail) belong to a particular mailing. Am I right?
Answers.UserDisplayName: Mohit Agarwal
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-08T13:28:01.773Z
Answers.Text: yeap, but they all use indexes, so no big deal
Answers.UserDisplayName: Xavier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-07T19:38:28.270Z
Answers.LastActivityDate: 2015-06-07T19:38:28.270Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>The event_queue_id points to a row in the event queue table which has a job id associated with it. The mailing job table is a join table which matches a job to a specific mailing.</p>
  
  <p>Check the civimail reports to give a better idea of the SQL used to construct the queries and extract useful info from the tables</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-08T03:39:11.490Z
Answers.LastActivityDate: 2015-06-08T03:39:11.490Z
Answers.UserDisplayName: Donald Lobo
Answers.Body: <p>Mailings are split into batches (jobs). On small mailings, you will have a single job and all emails will be sent at the same time, but that's definitely not going to be the case when you have more than one job.</p>
  
  <p>you can download the ERD from the wiki, but as Lobo was saying event->job->mailing
  Alter your query to add the mailing id (lots of join, but on indexes, it won't increase the speed)</p>
  
  <p><a href="http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+4.4+ER+Diagram" rel="nofollow">http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+4.4+ER+Diagram</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-08T12:59:06.933Z
Answers.LastActivityDate: 2015-06-08T12:59:06.933Z
Answers.UserDisplayName: Xavier
Body: <p>I've the dump of <strong>civicrm_mailing_event_delivered</strong> table. It has 3 fields - id, event_queue_id and timestamp.</p>
  
  <p>By looking at this table, how do I find the mails belonging to one particular mailing? Why is it wrong to assume that every mail in a mailing is sent at the same time? When I do Administer->Settings->Schedule Jobs-> Send Scheduled  mailings -> Execute now, it sends all the mails in the mailing at the same time.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-08T03:34:45.767Z
Comments.Text: You might want to do some quick reading on database design, specifically SQL schemas and normalized form. Your gsoc mentor should be Able to get u going on the right patb
Comments.UserDisplayName: Donald Lobo
Tags: <civimail><cron-job><database><mysql><gsoc>
Title: How do I find the mails belonging to a particular mailing by looking at the SQL tables?
ThreadText: # How do I find the mails belonging to a particular mailing by looking at the SQL tables?
  
  (Asked by: username_0 on 2015-06-07)
  
  I've the dump of **civicrm\_mailing\_event\_delivered** table. It has 3 fields - id, event\_queue\_id and timestamp.
  
  By looking at this table, how do I find the mails belonging to one particular mailing? Why is it wrong to assume that every mail in a mailing is sent at the same time? When I do Administer->Settings->Schedule Jobs-> Send Scheduled mailings -> Execute now, it sends all the mails in the mailing at the same time.
  
  **Tags:** civimail, cron-job, database, mysql, gsoc
  
  > **Comments:**
  > **username_1**: You might want to do some quick reading on database design, specifically SQL schemas and normalized form. Your gsoc mentor should be Able to get u going on the right patb  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2015-06-07. Score: 3
  
  Try the civicrm\_mailing\_recipients table - mailing\_id tells you which Mailing they relate to. Is that what you are after?
  
  > **Comments:**
  > **username_0**: What does id refer to in that table?  
  > **username_2**: just the row id for that table  
  > **username_0**: Using just the civicrm_mailing_recipients table, I get to know which email_ids belong to a particular mailing. But civicrm_mailing_event_delivered table does not contain the email ids, rather it stores information about event_queue_id. This means I would have to do join of 3 tables - civicrm_mailing_event_delivered, civicrm_mailing_recipients and civicrm_mailing_event_queue in order to find which all timestamps (of delivered mail) belong to a particular mailing. Am I right?  
  > **username_3**: yeap, but they all use indexes, so no big deal  
  
  ---
  
  ### Answer by username_1 on 2015-06-08. Score: 3
  
  The event\_queue\_id points to a row in the event queue table which has a job id associated with it. The mailing job table is a join table which matches a job to a specific mailing.
  
  Check the civimail reports to give a better idea of the SQL used to construct the queries and extract useful info from the tables
  
  
  ---
  
  ### Answer by username_3 on 2015-06-08. Score: 0
  
  Mailings are split into batches (jobs). On small mailings, you will have a single job and all emails will be sent at the same time, but that's definitely not going to be the case when you have more than one job.
  
  you can download the ERD from the wiki, but as username_1 was saying event->job->mailing
  Alter your query to add the mailing id (lots of join, but on indexes, it won't increase the speed)
  
  <http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+4.4+ER+Diagram>
  
  
  ---
  
  