Question about comparing large lists

  • Thread starter Thread starter The Bear
  • Start date Start date
T

The Bear

I'm trying to deteremine what would be the best way to check a set of inputs
for any updates.
Currently I have a "lookup" table in a db. And every so often when a new
item needs to be added, The entire set of inputs is checked against the
existing data. Anything that isn't found in the table is a new item and that
gets added.

What I would like to know if there is a more efficient way of checking for
updates.

T.B.
 
Keep in mind that if the table is indexed correctly, the check should be
fairly quick.

SELECT COUNT(Name) FROM MyTable WHERE Name = 'Hello' should be at worst an
O(log n) operation IIRC, assuming column Name is indexed.
 
Of course, we can't forget the flip side of this, that indexing impacts
insert, update, and delete operations negatively at the same time.
Depending on the number of operations that are being performed (select vs
insert, update, and delete), it might not be the best idea to actually place
an index on the table.

If the number of selects outweighs the other operations, then an index
is definitely a good idea.

Hope this helps.
 
Back
Top