I am joining three tables and then inserting the results into a new table. Sometimes the join statement produces a couple hundred rows (which runs quickly) but on occassion it produces around a million rows. (which doesn't run as quickly)The inserting of a million rows is sometimes unavoidable and the result set is correct. I am going to purchase a new server to exclusively run this sql server query but I am unsure what resources SQL Server 2000 uses to perform the calculations. I.E. would 16 GB of RAM decrease the process time? Faster Processors? Faster Hard drives/Raid 10 configurations?The query is listed below if there is something seriously wrong with the way I am joining but I think this is more of a processing power issue than a query optimization problem.BusinessMaster table contains 18 million recordsZipCodeMaster table contains 45,000 recordsNewBusinessTemp table contains roughly 2000 recordsI'm joining NewBusinessTemp to ZipCodeMaster on a dummy row called Filler where the values are always 1 and then using the Where statement to drill down to which ZipCodes I want to use. Then Joining my ZipCodeMaster to BusinessMaster on this ZipCode dataset and using Where to compare the Business Names to eachother. (Essentially trying to find a matching business name within a 35 mile radius of the zip code provided in NewBusinessTemp)Select BusinessMaster.CompanyName, BusinessMaster.City, NewBusinessTemp.BusinessName, NewBusinessTemp.Account, ZipCodeMaster.StateFrom (NewBusinessTemp inner join ZipCodeMaster On NewBusinessTemp.Filler = ZipCodeMaster.Filler) Inner Join BusinessMasterOn BusinessMaster.Zip = ZipCodeMaster.ZipCodeWhere ((dbo.CalculateDistance(NewBusinessTemp.Latitude, NewBusinessTemp.Longitude, ZipCodeMaster.Latitude, ZipCodeMaster.Longitude, 'Miles') < 35) And(dbo.CompareText(NewBusinessTemp.BusinessName, BusinessMaster.CompanyName) > 80)