473,756 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Index's in MySQL - Multiple index warning from PHPMyAdmin - please help.

Hi there,

Using PHPMyAdmin and it is very usefully reporting problems with my
MySQL DB.
"PRIMARY and INDEX keys should not both be set for column
`column_name`"

and

"More than one INDEX key was created for column `column_name`"

1) Will these warnings have a great impact on the speed of my DB?
2) Can I expect a performance improvement if I do fix them?

This probably stems from a few holes in my knowledge of indexes. I
understand what they do in principle but still a bit confused about
best implementation practises and can't find a useful online resource
to explain.

3) Can anyone point out a good guide on MySQL indexes and more details
on these warnings - particular with regard to multipe column indexes
and when these are useful.

There is one area in my DB where perfomance is darn slow. I cannot
figure out why and hoping better index understanding will help.

Thanks in advance.

Jul 23 '05 #1
1 3192
>Using PHPMyAdmin and it is very usefully reporting problems with my
MySQL DB.
"PRIMARY and INDEX keys should not both be set for column
`column_name `"

and

"More than one INDEX key was created for column `column_name`"
Show us the table definition, preferably SHOW CREATE TABLE output.
1) Will these warnings have a great impact on the speed of my DB?
If you have two identical indexes on the same column (or set of
columns in the same order), it wastes disk space and it takes time
to keep them updated, to no benefit whatever. As to whether it is
a GREAT impact, I don't know, but it will have most impact on
updates, not reads. Getting rid of IDENTICAL indexes is a no-brainer.
2) Can I expect a performance improvement if I do fix them?
Probably but it may not be measurable.
Note that having the same column in two different indexes is
not necessarily bad, and it can improve performance. Consider
the schema:

table hourly
stamp datetime,
host enum(.....),
type enum(.....),
value

This table holds a bunch of statistics: stamp is which hour, host
is which host it's for, type is the particular statistic over
an hour (mail received, mail sent, bytes of network traffic, etc.).

I have a primary key of (stamp, host, type) for queries that look
at the completeness of the statistics (and keep out duplicates).
(select * from hourly order by stamp, host, type). I have an index
on (type, host) for queries that generate graph data (select * from
hourly where type = 'sometype' and host = 'somehost' and stamp >=
'sometime' order by stamp ). Neither index is much use for the other query.
If I remove either one, performance for the corresponding query slows
to a crawl (database has about 6 million records).
This probably stems from a few holes in my knowledge of indexes. I
understand what they do in principle but still a bit confused about
best implementation practises and can't find a useful online resource
to explain.

3) Can anyone point out a good guide on MySQL indexes and more details
on these warnings - particular with regard to multipe column indexes
and when these are useful.

There is one area in my DB where perfomance is darn slow. I cannot
figure out why and hoping better index understanding will help.


Show us the query and the schema. Note that a multi-column key
isn't good for much unless you know the values of the *FIRST* N
columns in it (much like looking for all of the people with the
first name "George" in a traditionally-indexed phone book is a
painful job) or perhaps the first N-1 columns and a range on
the Nth.

Gordon L. Burditt
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
7394
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere. Good food.", " (Harry Houdini - 03/01/2004)"); INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada", " (Herbert Hoover - 03/03/2004)"); INSERT INTO `reviews` VALUES("", "Golden Dragon", "Lunch", "Exquisite.
6
3700
by: barsepsi | last post by:
(I apologize for my "ugly" english... :-) I'm a beginner with Linux (Mandrake 9.1) and try to run my own local web server. Apache 1.3.27 et PHP 4.3.3 are OK. The problem is MySQL... I tried with the 3.23.56 version and the 4.0.1. Always, I recompiled. I have installed also phpMyAdmin (once agin, in 2 versions) in order to understand what happened. It is able to connect to the database but not to read the data. I tried to "see" my...
6
1985
by: Greg Brant | last post by:
Hi, how can i backup a table / entire DB and get the index's as well as the data / create table's etc cheers Greg
2
5664
by: news reader | last post by:
Hi, Does anoone of you know if there is already a simple application doing something like this. I would enhance / tune the missing features, but would like to avoid to start from scratch or to start from something, that has far too many features and is difficult to setup.
12
2726
by: mistral | last post by:
phpMyAdmin 2.6.2 problem: can no connects to mySQL database: each time shown error #1045 - Access denied for user 'username'@'192.168.1.2' (using password: YES) Is seems, this is most common problem for mySOL and phpMyAdmin. Extremelly ugly and inconvenient program.
8
7098
by: deko | last post by:
I've just loaded phpMyAdmin on a Debian Linux server with Apache2, MySql5 and PHP5. myserver # dpkg -l | grep php ii libapache-mod-php5 5.2.0-8+etch4 ii libapache2-mod-php4 4.4.4-8+etch2 ii php4-common 4.4.4-8+etch2 ii php5-common 5.2.0-8+etch4 ii php5-gd 5.2.0-8+etch4 ii php5-mcrypt 5.2.0-8+etch4
5
2955
by: suma | last post by:
hi to all plaese help me i have same problem when download the phpdev and phptriad i cant connect to mysql when click the MyAdmin apear this messege in the page 'Warning: MySQL Connection Failed: Can't connect to MySQL server on 'localhost' (10061) in C:\apache\htdocs\phpmyadmin\lib.inc.php on line 255"
39
5869
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
10
1819
by: Caffeneide | last post by:
I'm using a php script which performs three xml queries to other three servers to retrieve a set of ids and after I do a query to mysql of the kind SELECT * FROM table WHERE id IN ('set of ids'); Although I'm sure the connection to the database is ok, I sometimes get an error of this kind: *Warning*: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in ... This does not happen every time i run the script, only...
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.