Welcome Guest, Not a member yet? Register   Sign In
Why no "limit" to a model select/update?
#1

When using a model such as

$model->find(1) or $model->update(1,[values])

Why does it not automatically apply a LIMIT 1 in the query? If I am accessing a table with millions of records wouldn't it be a lot slower without the limit in general. If I pass in (one) id and it's the primary id there would never be a case where it should look for or update more then 1 record.

$model->update(1,[values]) turn into UPDATE tbl SET col = 'val' WHERE id IN (1)

Unless the database (mysql, mysqli driver) in my case actuomatically stops trying to find records after reaching one even without the limit? (I do not know)

Thanks
Reply


Messages In This Thread
Why no "limit" to a model select/update? - by Cyto5 - 07-10-2020, 01:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB