![]() |
mysql index
I'm teaching mysql sql now and wanted to know if i have undestood the indexpart right.
I have a query [sql] SELECT r_invites.*, user.username FROM " . TABLE_PREFIX . "r_invites LEFT JOIN " . TABLE_PREFIX . "user AS user USING(userid) where userid = " . $vbulletin->userinfo['userid'] . " ORDER BY r_invitesid DESC [/sql] should now the useridcolumn have a index to be faster because its in the where part? 2. example: [sql] SELECT * FROM " . TABLE_PREFIX . "link where catid = ". $catid . " order by linkid DESC [/sql] here the catid should have one or? |
You are correct. Indices should be placed on columns that are compared two - however, over use and you will waste space. (Remember that primary keys are indexed automagically.)
|
thx
|
All times are GMT. The time now is 09:45 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|