> Not directly related to your question, but I suspect pigz and gnu parallel would dramatically speed up your current command-line technique, if you are on a multi-processor machine.
I was using pigz :-)
> I presume your cut is required because of other potential row conflicts, so one last thing you might test is the timings of putting cut after the fgrep instead of in front of it. This can be counter-intuitive but might make a difference for you.
The cut was actually bro-cut which is a lot faster than cut. I couldn't use grep -> cut because it would find the value I was looking for in other fields. awk '$5 == 23' or such would have worked, but awk is slower than bro-cut too.
> If you are using sort to do your "count_distinct", try to make sure that sort's temporary files are on a different hard disk from the files you are reading.
I wasn't.. The number of unique values easily fit in memory, so I used a short python program that also counted the frequency of the values.
> Speaking of which, the disks you are reading off of will often be your bottleneck when processing large files through command line pipes.
It's a gigantic freenas box over 10G ethernet, so mostly the time is spent uncompressing the data and ignoring all but 2 of the columns, which is why data stored in a columnar format would be a lot faster.