Welcome Guest, Not a member yet? Register   Sign In
Smart $ Fast database select and get single data - field entry :)
#1

[eluser]flash_back[/eluser]
here is thing, when I have just one or maybe two database entry to get i use this code Smile

Code:
$this->db->where('data', $data)->get($this->_table)->row()->table_field;

but what do you think, when we get data from DB from this code, does this code select all table fields or just included one?!?
#2

[eluser]danmontgomery[/eluser]
if you don't specify fields to select, SELECT * is used, which is all fields.
#3

[eluser]cahva[/eluser]
You dont use select so it gets every field to the result(using *). If you dont want that, add select('table_field') for example:
Code:
$this->db->select('table_field')->where('data', $data)->get($this->_table)->row()->table_field;
#4

[eluser]flash_back[/eluser]
yes, that is that answer, thanks Smile
#5

[eluser]flash_back[/eluser]
now I am not sure who is right here?!?

after 52 query updates (just on forum model) whit select on tables that runs for forum posts, topics and structure I don't get any visible speed up, pages generating time on every page is almost the same...

of course, all 52 update query's don't loading at same page and time, but maybe on forum index 10-15 of them is calling altogether! I think that situation is same, I am of course ask users what they think so update will be shortly Smile
#6

[eluser]danmontgomery[/eluser]
With only one table, you're looking at a difference of thousandths of a second per query (or less)... It's unlikely there will be a noticeable difference in what you see.
#7

[eluser]flash_back[/eluser]
i agree




Theme © iAndrew 2016 - Forum software by © MyBB