• Hi,

    Here is where the problem:

    update #regions set countryId = (select countryId from tbl_ip2countries where ipFloat between ipFrom and ipTo)

    The above update statment will be executed on (roughly 2000 rows as a sample) all the rows of the temp table whereas it reads the data from the base table which is about 2 million records, hence it would read the records from the base table on each row of the temp table, thus it will use the tempdb for a better performace, the Index spool is happening, why don't you try this with a inner join, so it can search for exact rows and make it faster..

    Thanks,

    Prabhu