title: How can I most efficiently get these group_by stats in MYSQL statement
body: <p>Suppose I have a MySQL table that was created like this:</p>
  
  <pre><code>CREATE TABLE `my_table` (
    `my_id` char(32) NOT NULL,
    `my_boolean_field` tinyint(1) DEFAULT NULL,
    PRIMARY KEY (`my_id`),
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>This table is very large. It has approximately 10 million rows in it. <code>my_boolean_field</code>'s only possible values are <code>1</code>, <code>0</code> and <code>null</code>.</p>
  
  <p>Now separately, I have a list of 500 IDs. Let's call this <code>my_list</code>. They are in a text file separated by newlines. The name of that file is <code>myfile.txt</code>. The entries in this file are too long to include in a single <code>where</code> clause of an SQL statement.</p>
  
  <p>I want to answer the following questions:</p>
  
  <ol>
  <li>How many of the rows in <code>my_table</code> have and ID that is in <code>my_list</code> and my_boolean_field is null.</li>
  <li>How many of the rows in <code>my_table</code> have and ID that is in <code>my_list</code> and my_boolean_field==1.</li>
  <li>How many of the rows in <code>my_table</code> have and ID that is in <code>my_list</code> and my_boolean_field==0.</li>
  <li>How many of the rows in <code>my_table</code> have and ID that is not in <code>my_list</code> and my_boolean_field is null.</li>
  <li>How many of the rows in <code>my_table</code> have and ID that is not in <code>my_list</code> and my_boolean_field==1.</li>
  <li>How many of the rows in <code>my_table</code> have and ID that is not in <code>my_list</code> and my_boolean_field==0.</li>
  </ol>
  
  <p>What is the most performant way to get the above 6 counts??</p>