Welcome Guest, Not a member yet? Register   Sign In
Which MySQL Fields Should be Indexed?
#1

[eluser]Vik[/eluser]
I've got a database lookup that looks like this:
Code:
$this->db->where('id=', $user_id);
$this->db->join('Description', 'Description.NDB_No = user_prefs.NDB_No');
$this->db->join('ABBREV', 'Description.NDB_No = ABBREV.NDB_No');
$this->db->orderby('Long_Desc');
$main_database_query = $this->db->get('user_prefs');
I see I can have MySQL tables indexed on individual fields, and also, on combinations of fields.

I'm guessing that the user_prefs table should have an index for the combination of fields, $user_id and NDB_No - rather than individual indexes for each field. Is this correct?




Theme © iAndrew 2016 - Forum software by © MyBB