Question about comparing large lists

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.
 
S

Sean Hederman

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.
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top