IT Community - Software Programming, Web Development and Technical Support

Setting Index for mysql table fields

This is a discussion on Setting Index for mysql table fields within the Database Support forums, part of the Web Development category; hi, how many index can be created for a mysql table if the table has 100 fields?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-10-2007, 03:01 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,162
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Setting Index for mysql table fields

hi,
how many index can be created for a mysql table if the table has 100 fields?
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-16-2007, 06:50 AM
vadivelanvaidyanathan vadivelanvaidyanathan is offline
D-Web Genius
 
Join Date: Feb 2007
Posts: 803
vadivelanvaidyanathan is on a distinguished road
Default Re: Setting Index for mysql table fields

Index can be created for all the fields.If its needed then we can create 100 indexes in the same table.

-V.Vadivelan
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-17-2007, 01:35 AM
priyan priyan is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 133
priyan is on a distinguished road
Default Re: Setting Index for mysql table fields

Hi,

Creating an index requires creating a key, and there's a limit placed on the number of keys allowed for a table. So the limit on indexes is governed by the number of keys you are allowed to create.

I have tested this in mysql 5.0.22-max-log.
-- Creating a table with 80 Columns.
-- while we creating 70 indexes for all columns in that table, indexes
created only for 64 columns and reported the below given error..

ERROR 1069: Too many keys specified. Max XX keys allowed

From the MySQL Documentaion Error: 1069 SQLSTATE: 42000 (ER_TOO_MANY_KEYS)
Message: Too many keys specified; max %d keys allowed.

It seems like that we can have maximun 64 indexs in a table. (Here we did't consider full text indexes)

I have reviewed some forums and it appears that this limit is controlled by the MAX_KEY variable in the source code (sql/unireg.h). Changing the value requires a recompile of MySQL.

- Priyan..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-13-2007, 11:57 PM
pras_kris pras_kris is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 3
pras_kris is on a distinguished road
Default Re: Setting Index for mysql table fields

Lot of thanks,how many cluster & non cluster index possible in a table
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-15-2007, 11:22 PM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: Setting Index for mysql table fields

Hi,


We can have only one Clustered Index in a Table as it will be unique for every table.

There can be any number of Non-Clustered Index in a table as its just a pointer to the data on a table.
__________________
-Murali..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
CACHE INDEX In MySql prasath Database Support 0 09-19-2007 10:49 PM
Mysql - Table Join write2ashokkumar Database Support 2 09-14-2007 06:12 AM
What are the different index configurations a table can have in sql Server 2005? Archer Database Support 1 07-25-2007 03:33 AM
What is a table called, if it does not have neither Cluster nor Non-cluster Index?.. Archer Database Support 2 07-19-2007 12:19 AM
How to calculate the table size in mysql write2ashokkumar Database Support 1 07-11-2007 08:08 AM


All times are GMT -7. The time now is 07:47 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0