MySQL Forums
Forum List  »  German

Re: Automatisches Indexieren???
Posted by: Hakan Kuecuekyilmaz
Date: December 01, 2008 04:54AM

Hallo Alexander,

einfach so Indexe setzen, schadet mehr als es nützt. Daher solltest du dein Log durchgehen und schauen, welche Abfragen am meisten Zeit benötigen. Bei den Abfragen mit den längsten Abarbeitungszeiten schaust du dann auf die WHERE-Klausel und überprüfst, ob es zu dem entsprechenden Feld einen Index gibt.

Beispiel:
# Nehmen wir an, diese Abfrage ist extrem langsam.
SELECT a, b, c FROM t1 WHERE b = 3;

mysql> SHOW CREATE TABLE t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `a` int(11) NOT NULL AUTO_INCREMENT,
  `b` int(11) DEFAULT NULL,
  `c` varchar(25) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

In diesem Fall würdest du auf t1.b einen Index setzen.

Viele Grüße,

Hakan

Hakan Küçükyılmaz, MariaDB http://askmonty.org/

Options: ReplyQuote


Subject
Views
Written By
Posted
3941
December 01, 2008 03:49AM
Re: Automatisches Indexieren???
2093
December 01, 2008 04:54AM
2417
December 01, 2008 08:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.