GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 28-May-2004, 04:08
eRIC eRIC is offline
Awaiting Email Confirmation
 
Join Date: Nov 2003
Location: Kyrgyzstan
Posts: 31
eRIC is on a distinguished road
Exclamation

Indexing table


Hi do i have to use index in my table where there is a column Num. Which must be unique, for each person. I my files i have search form to search by Num too.
Do i have to set Num column to UNIQUE? and create index for faster search?
  #2  
Old 28-May-2004, 06:22
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
UNIQUE is an index, so if the column data is unique to each row, then make it UNIQUE. Otherwise use EXPLAIN with your SELECT statement to see if the SQL is optimised to your table structure.
  #3  
Old 28-May-2004, 07:03
eRIC eRIC is offline
Awaiting Email Confirmation
 
Join Date: Nov 2003
Location: Kyrgyzstan
Posts: 31
eRIC is on a distinguished road

Ok


Quote:
Originally Posted by JdS
UNIQUE is an index, so if the column data is unique to each row, then make it UNIQUE. Otherwise use EXPLAIN with your SELECT statement to see if the SQL is optimised to your table structure.
i'm using it right now.
  #4  
Old 28-May-2004, 07:09
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
eRIC,

Have you ever tried using EXPLAIN with your SELECT statements before? If you haven't, try inserting the word "EXPLAIN" to your SQL statement and see the results...

For example, if your SQL is something like this:

SELECT `name`, `number` FROM `client` WHERE `id`=256

try something like this instead:

EXPLAIN SELECT `name`, `number` FROM `client` WHERE `id`=256

Paste the results if you want me to 'explain' the report/result...
  #5  
Old 28-May-2004, 21:55
eRIC eRIC is offline
Awaiting Email Confirmation
 
Join Date: Nov 2003
Location: Kyrgyzstan
Posts: 31
eRIC is on a distinguished road
Quote:
Originally Posted by JdS
eRIC,

Have you ever tried using EXPLAIN with your SELECT statements before? If you haven't, try inserting the word "EXPLAIN" to your SQL statement and see the results...

For example, if your SQL is something like this:

SELECT `name`, `number` FROM `client` WHERE `id`=256

try something like this instead:

EXPLAIN SELECT `name`, `number` FROM `client` WHERE `id`=256

Paste the results if you want me to 'explain' the report/result...

query: EXPLAIN SELECT `AdiTur` , `SicilNo` FROM `basa` WHERE `Id` =18

table | type |possible_keys |key| key_len|ref|rows|extra
--------------------------------------------------------
basa const PRIMARY PRIMARY 4 const 1


??????????
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
customizing preprocessor and hash table incognito54 C Programming Language 2 21-Apr-2004 19:25
Trying to retrieve selective results from a table. icsys MySQL / PHP Forum 9 18-Nov-2003 04:31
Recall table row misunderstood MySQL / PHP Forum 3 23-Aug-2003 09:56
form in a table cell blelisa Web Design Forum 1 19-Aug-2003 10:14
[Tutorial] MySQL Basics nniehoff MySQL / PHP Forum 15 23-Mar-2003 20:42

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:20.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.