From: Drew Olson Date: 2007-02-09T01:33:02+09:00 Subject: Re: General Approach to Data Validation Brian Candler wrote: > I'd suggest: > > 1. sort both the datasets by the primary key (or SELECT ... ORDER BY) > > 2. run through both lists with a pointer to each. This lets you > efficiently > find records which are in A but not in B, and vice versa. This is a > linear-time operation. > > 3. then, for records which are in both A and B, you can compare them > attribute-by-attribute. I think you've hit the nail on the head with this. It will drastically reduce the number of queries I make. I'm coding it up now and taking a look at the performace difference. Thanks for your help, Drew -- Posted via http://www.ruby-forum.com/.