Comment IOPS or bust (Score 1) 66
Not saying this isn't actually really exciting, but that's the metric in at least 90% of use cases.
OK, now with 3.13M families:
# echo 'select child1_gender,count(*) from families where child2_gender = "M" and child2_day=2 group by child1_gender;' | mysql test
child1_gender count(*)
F 111608
M 112037
50.095% male. If I remove the Tuesday constraint?
# echo 'select child1_gender,count(*) from families where child2_gender = "M" group by child1_gender;' | mysql test
child1_gender count(*)
F 783068
M 784087
50.03% male.
But you know, perhaps I'm being not literal enough. It's always possible to misencode a problem, and there's a lot of insistence that you have to handle the overlapping case of boy/boy. So, lets try a different mechanism. Lets literally do what the problem asks:
"I have two children, one of whom is a boy born on a Tuesday. What's the probability that my other child is a boy?"
For each family, if either of the children is male, return whether they are both male.
# echo 'select child1_gender=child2_gender from families where (child1_gender="M" and child1_day=2) or (child2_gender="M" and child2_day="2") ' | mysql test | sort | uniq -c | sort -n
1 child1_gender=child2_gender
207934 1
223445 0
...heh! That's kind of neat! I think I shall play with this some more.
Thus mathematics may be defined as the subject in which we never know what we are talking about, nor whether what we are saying is true. -- Bertrand Russell