Skip to content
Advertisement

Tag: data-structures

What is a runtime complexity of this sql query?

I would like to know how fast is SELECT * FROM user_table WHERE email = ‘test@gmail.com’ is this O(1) or O(n)? how does sql search for a particular row? Answer If there is no index on “email” column, the search complexity is O(N). If there was hash-based index on an “email” column, then the search could be performed in O(1).

Advertisement