MySQL Forums
Forum List  »  German

FROM tab1 tab2 performance problem
Posted by: Thomas Huxhorn
Date: September 11, 2013 03:06PM

Hallo,

ich habe ein Geschwindigkeitsproblem wenn ich in der SELECT Anweistung mehr als eine Tabelle benutze.

Aber ein Beispiel sagt mehr als 10000 Worte.

Ich berechne nur den Mittelwert von ca. 11000 Einträgen.

mysql> select avg(`2010`.Temperatur) from `2010`, `2013`;
+------------------------+
| avg(`2010`.Temperatur) |
+------------------------+
| 9.268409636079625 |
+------------------------+
1 row in set (16.04 sec)

mysql> select avg(`2010`.Temperatur) from `2010`;
+------------------------+
| avg(`2010`.Temperatur) |
+------------------------+
| 9.26840963601753 |
+------------------------+
1 row in set (0.01 sec)

mysql> select avg(`2013`.Temperatur) from `2013`;
+------------------------+
| avg(`2013`.Temperatur) |
+------------------------+
| 10.696638655749297 |
+------------------------+
1 row in set (0.01 sec)


Warum braucht die eine Abfragr 16sec und die andere 0.01sec?
Bei 3 oder 4 Tabellen dauert es schonmal eine Stunde!

Danke für die Mühen.

Mehr Info:
mysql> describe `2010`;
+----------------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------+------+-----+---------+----------------+
| ID | int(11) | NO | PRI | NULL | auto_increment |
| Datum | date | NO | | NULL | |
| Zeit | time | NO | | NULL | |
| Temperatur | float | NO | | NULL | |
| Luftdruck | int(11) | NO | | NULL | |
| Windgeschwindigkeit | float | NO | | NULL | |
| Windrichtung | int(11) | NO | | NULL | |
| rel Luftfeuchtigkeit | int(11) | NO | | NULL | |
+----------------------+---------+------+-----+---------+----------------+

System Debian Linux
mysql Ver 14.14 Distrib 5.5.31

Options: ReplyQuote


Subject
Views
Written By
Posted
FROM tab1 tab2 performance problem
1272
September 11, 2013 03:06PM


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.