ado.net , sql server, and asymptotic time complexity

  • Thread starter Thread starter jay widman
  • Start date Start date
J

jay widman

We are new to relational databases in general
and sql server in particular.
Is a search for a record by indexes
O(log n)?
Is the insert and delete operation O(n log n)?
We are assuming that a record update without
changing the primary/foreign key values is
also O (log n). Correct?

thanks in advance
jay widman
 
Hi Jay,

It's more complicated than this. The database has query optimization
routines that are repeatedly accessed to determine the best way to solve a
given event - query, search, etc, although the developer (like me) rarely
needs to be aware of the optimization method employed. (And, yes, there are
ways to tweak those methods with 'hints' etc).

The people who know a lot more about this can be found at
microsoft.public.sqlserver.server.

HTH,

Bernie Yaeger
 
Bernie is right... but it's even more complex than he suggests. The query
optimizer prepares and optimizes the query plan based on several factors
including available Index statistics and (most importantly) the parameters
passed to the query. This plan is cached and (possibly) reused regardless of
the parameters passed by subsequent executions. This means the first query
to arrive calling a stored procedure can establish a perfectly suitable
query plan or one that really sucks wind (for lack of a better term)
performance-wise.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top