If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Which Index scheme is best suitable ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-22-11, 22:01
learnerkid learnerkid is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Exclamation Which Index scheme is best suitable ??

Which Index  scheme is best suitable ??-per.png

above is the figurefor which we have to apply indexing scheme, click to enlarge the figure

Hi above is the Shema pls suggest which would be best indexing scheme suitable for this ie clustering, primary,secondary .My request to database masters is that all of us know how to write queries so there is no need for queries here , we can observe table and one can easily tell which indexing scheme is best choosen so my request is to please suggest which indexing scheme we can apply here and why ??
Reply With Quote
  #2 (permalink)  
Old 04-23-11, 04:00
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
so what do you think you will need to index, bearing mind the ways you expect the data to accessed
what do you think needs to indexed so the SQL engine will benefit from indexing
so what coloumn(s) in waht index(es)
as a first off I'd expect all PK's and where appropriate FK's
but what e3lse strikes you as benefitting from indexing?
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 04-23-11, 06:44
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
My advise here is no queries, then no indexes needed.

I think this question has been raised before.

Your requirement is like saying I need a client system developed but I am not going to tell you about what is in it because you should all already know.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #4 (permalink)  
Old 04-23-11, 06:57
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by it-iss.com View Post
I think this question has been raised before.
you recall correctly, sir

Which indexing scheme to choose from ??

he got no indexes then because he refused to show his queries

i see the same outcome in this thread

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 04-24-11, 20:33
learnerkid learnerkid is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Exclamation

hi ,

i looked into the index , as for learning u do not need a queries like you are really doing a actual implementation , you can identify columns which would be frequently updated ( pls who gives answer can make suitable assumption ) and hence forth it is possible to know which column will be constructed on primary /keyfield or non keyfield and so which index type to choose seeing their perfomance efficiency and validity . I have no queries sorry , its a very basic question which was from reputed material ( stated that no queries required at start just make assumption of fields getting updated )

So database masters I have explained what ever is the scenarion , pls help !!
Reply With Quote
  #6 (permalink)  
Old 04-24-11, 20:45
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
okay, here, try this ...

on each table, figure out which column is the primary key, and declare it when you create the table using PRIMARY KEY syntax -- this will automatically create a unique index on that column

in addition, declare an index on each column used as a foreign key in other tables, e.g. custno in the account table

vwalah!! there is your answer to your "very basic question which was from reputed material"
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 04-24-11, 20:51
learnerkid learnerkid is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
hi , thanks for the help , the index created on primary key will e by default cluster index , right ? , now for the other attributes how will u decide from above schema which index we can use , see you can assume some fields gets updated most frequently so we use index on it , pls guide me , I know in real time we require query but its just a example so pls guide !!
Reply With Quote
  #8 (permalink)  
Old 04-24-11, 21:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by learnerkid View Post
see you can assume some fields gets updated most frequently so we use index on it
this is incorrect

just because a column is updated frequently, it does ~not~ get an index

for example, current_balance in your account table is probably the most frequently updated column in that table -- but it does not get an index

i've said it before, and this is the last time i will say it -- indexes are ~not~ created in a vacuum, they are created in order to optimize specific queries, and if you cannot give a specific query, then you do not need any more indexes

good bye and good luck
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On