Hi Marco, all,

this list uses English - I will translate the main points only:

Marco Baar wrote:
Hallo,

Ich benutze mysql seit 2 Jahren. Inzwischen haben sich 50MB Nutzdaten
angesammeln und hab ein Problem mit der Performance während der Abfrage
meiner "Haupttabelle".
| Using MySQL for 2 years now, having accumulated 50 MB of data,
| got a performance problem while querying my "main table".

Die Tabelle hat ca 200.000 Datensätze und ich mache im verhältnis zu anderen
Abfragen doch ein eher simplen select.
| Table has about 200,000 rows of data, "select" command is rather
| simple.

Ich selektiere mit Prüfung auf 4 Attribute (mit "=" ) und es dauert 0,2-0,4
sekunden. Damit kann ich leben. Diese Abfrage musste ich abwandeln und will
mir nur die ersten 50 Ergebnisse anzeigen, die nach Datum sortiert sind.
Diese allerdings dauert ~3,5 sekunden und legt meinen Rechner lahm. Sogar
der Sound wird unterbrochen.
| I select with an "=" condition on 4 attributes, that takes 0.2 - 0.4
| seconds which is ok for me. I had to change it and now want to show
| the first 50 results only, ordered by date. However, this takes about
| 3.5 seconds and fully occupies my computer, even interrupts the sound.

Is this date column supported by an index?
Is it part of your "where" criteria?
Can you include it in your "where" criteria, probably by giving some limit which applies to more than those 50 records?

What does "explain" tell about your query?

The basic problem will always remain:
"order by" requires the full result set to be constructed and then sorted, unless you created an index on that column. Sorting takes space, and this may exceed the RAM you configured MySQL to use, so causing disk I/O (= slow!), and it takes time, growing more than proportional with the number of items (AFAIK, there is no "O(n)" sorting algorithm).

So the best solution for this is an appropriate index structure.



2. Frage: Ich würde dies gerne als Daimon oder Server im Hintergrund laufen
lassen, so dass mich die Datenbankabfragen nicht im Laufenden Betrieb
stören. Trotzdem sollen doch relativ complexe Abfragen gemacht werden.
| Second question: I would like to run that in the background, so that
| interactive use is not affected. But complex queries will be made.

Ist es möglich, bestimmte Benutzer mit sehr geringer Priorität auszustatten,
dass deren Abfrage nicht über einen bestimmten %-Wert der Cpu-last geht und
somit den laufenden Betrieb nicht stören?
| Is it possible to assign a low priority to certain users, so that
| their queries do not exceed a certain percentage of CPU load?

"Priority" is an attribute of processes, not of users.
You can "nice" the whole MySQL server (assuming this is a Unix system), but that would affect all queries of all users (run within this server). You can also "nice" certain users' client processes, thus reducing the number of queries they send if the machine is busy.

I do not know a means to do that within the server. If it is important to you, the best way may be to use a separate DB server machine.


HTH (= hope that helps),
Jörg

--
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to