• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
->row() without limit() causes high load

#1
i noticed that selecting row() without putting limit() in the active record is causing high load !!

anyone noticed that ?
Reply

#2
Of course it will it's pulling in all the records matching your search.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(05-16-2018, 04:19 AM)InsiteFX Wrote: Of course it will it's pulling in all the records matching your search.

It is supposed that results() does that but row() by default limits to 1 !!
Reply

#4
Use Prepared Statements with PDO
Reply

#5
(05-17-2018, 01:32 PM)khashabawy Wrote:
(05-16-2018, 04:19 AM)InsiteFX Wrote: Of course it will it's pulling in all the records matching your search.

It is supposed that results() does that but row() by default limits to 1 !!

1. row return 1, but it does not limit the results from the database.
2. Add an index to the field. An index speed up the search.
Reply

#6
(05-17-2018, 09:55 PM)Paradinight Wrote:
(05-17-2018, 01:32 PM)khashabawy Wrote:
(05-16-2018, 04:19 AM)InsiteFX Wrote: Of course it will it's pulling in all the records matching your search.

It is supposed that results() does that but row() by default limits to 1 !!

1. row return 1, but it does not limit the results from the database.
2. Add an index to the field. An index speed up the search.

Does not this considered a bug ? why does not row() limit to 1 row() ?
Reply

#7
There is a reason for that.
Read the docs https://www.codeigniter.com/user_guide/d...sults.html (Result Rows)
Reply

#8
(05-18-2018, 04:40 AM)khashabawy Wrote: Does not this considered a bug ? why does not row() limit to 1 row() ?

There is a difference between making a query and obtaining a results set from a query.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.