phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

PRIMARY and INDEX keys should not ...


 
Search this topic... | Search Knowledge Base (KB)... | Search Box
Register or Login to Post    Index » Knowledge Base (KB)  Previous TopicPrint TopicNext Topic
Author Message
espicom
Board Member



Joined: 24 Nov 2008

Posts: 55
Location: Woodstock, IL


flag
PostPosted: Sun Jan 11, 2009 3:34 pm 
Post subject: PRIMARY and INDEX keys should not ...

The following is an informational message. There isn't anything to "fix".

A relatively recent version of phpmyadmin wrote wrote:
PRIMARY and INDEX keys should not both be set for column `session_id`


This phpmyadmin warning, not a phpBB error. It isn't an error or something that will cause you problems with your site; it's just something phpmyadmin reports.

Let's start with the sessions table schema, from the install archive:

Code:
# Table structure for table 'phpbb_sessions'
#
# Note that if you're running 3.23.x you may want to make
# this table a type HEAP. This type of table is stored
# within system memory and therefore for big busy boards
# is likely to be noticeably faster than continually
# writing to disk ...
#
CREATE TABLE phpbb_sessions (
       session_id char(32) DEFAULT '' NOT NULL,
       session_user_id mediumint(8) DEFAULT '0' NOT NULL,
       session_start int(11) DEFAULT '0' NOT NULL,
       session_time int(11) DEFAULT '0' NOT NULL,
       session_ip char(8) DEFAULT '0' NOT NULL,
       session_page int(11) DEFAULT '0' NOT NULL,
       session_logged_in tinyint(1) DEFAULT '0' NOT NULL,
       session_admin tinyint(2) DEFAULT '0' NOT NULL,
       PRIMARY KEY (session_id),
       KEY session_user_id (session_user_id),
       KEY session_id_ip_user_id (session_id, session_ip, session_user_id)
);


The three defined keys do not duplicate each other, although they share elements. The warning phpmyadmin pops up is because there is a "non-unique index" which contains the entire contents (one field) of a unique (and primary) index.

The three indexes are used strictly to "convince" MySQL to cache more information for speed... and to have at least one key that would contain "everything" that MySQL might use to look up a session by. There should never be more than one session ID, which is why session_id is a "primary" index. But a single IP or user might have multiple sessions in progress.

Now, about the "warning".... Earlier versions of phpmyadmin (2.60 and earlier, in my testing) do not "detect" the "problem". It can be safely ignored. Or, if you're obsessive-compulsive, you can change the order of the fields in session_id_ip_user_id, to put, say, the session_ip as the first field. It won't affect how MySQL uses (or doesn't use) the index.
Back to top
Display posts from previous:   
Register or Login to Post    Index » Knowledge Base (KB)  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0259 seconds using 15 queries. (SQL 0.0017 Parse 0.0008 Other 0.0235)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo