Problem:
I have a list of millions of transactions. Each transaction contains items (eg 'carrots', 'apples') the goal is to generate a list of pair of items that frequently occur together in individual transactions. As far as I can tell doing an exhaustive search isn't feasible.
Solution attempts:
So far I have two ideas. 1) Randomly sample some appropriate fraction of transactions and only check those or 2) count how often each element appears, use that data to calculate how often elements should appear together by chance and use that to modify the estimate from 1.
Any tips, alternative approaches, ready-made solutions or just general reading suggestions are much appreciated.
Edit:
Some additional information from the comments
Number of diffent items: 1,000 to 100,000
Memory constraint: A few gigs of ram at the most for a few hours.
Frequency of use: More or less a one off.
Available resources: 20-100 hours of newbie programmer time.
Desired result list format: Pair of items and some measure how often they appear, for the n most frequent pairs.
Distribution of items per transactions: Unknown as of now.