|
Home > Archive > MySQL ODBC Connector > September 2005 > Performance problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Performance problem
|
|
| Marco Baar 2005-09-29, 3:23 am |
| 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".
Die Tabelle hat ca 200.000 Datensätze und ich mache im verhältnis zu anderen
Abfragen doch ein eher simplen select.
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.
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. 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?
Vielen Dank für die Bearbeitung meiner Anfrage.
Marco Baar
--
Gruß
Marco
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
| |
| Nuno Pereira 2005-09-29, 7:24 am |
| What?
Please post in english.
Marco Baar wrote:
> Hallo,
>=20
> Ich benutze mysql seit 2 Jahren. Inzwischen haben sich 50MB Nutzdaten
> angesammeln und hab ein Problem mit der Performance w=E4hrend der Abfra=
ge
> meiner "Haupttabelle".
> Die Tabelle hat ca 200.000 Datens=E4tze und ich mache im verh=E4ltnis z=
u anderen
> Abfragen doch ein eher simplen select.
> Ich selektiere mit Pr=FCfung auf 4 Attribute (mit "=3D" ) 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=
=2E
> Diese allerdings dauert ~3,5 sekunden und legt meinen Rechner lahm. Sog=
ar
> der Sound wird unterbrochen.
>=20
> 2. Frage: Ich w=FCrde dies gerne als Daimon oder Server im Hintergrund =
laufen
> lassen, so dass mich die Datenbankabfragen nicht im Laufenden Betrieb
> st=F6ren. Trotzdem sollen doch relativ complexe Abfragen gemacht werden=
=2E Ist
> es m=F6glich, bestimmte Benutzer mit sehr geringer Priorit=E4t auszusta=
tten,
> dass deren Abfrage nicht =FCber einen bestimmten %-Wert der Cpu-last ge=
ht und
> somit den laufenden Betrieb nicht st=F6ren?
>=20
> Vielen Dank f=FCr die Bearbeitung meiner Anfrage.
>=20
> Marco Baar
--=20
Nuno Pereira
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
| |
| Andy Eastham 2005-09-29, 7:24 am |
| Marco,=20
Traurig - ich habe das google=FCbersetzungs
hilfsmittel benutzt, um zu
versuchen, Ihnen zu helfen.
Bevor Sie Benutzerpriorit=E4te
n betrachten, schlage ich Sie Blick an =
vor, wie
Ihre Daten registriert werden. Mysql verwendet nur einen Index pro =
Frage,
also mu=DF Ihre Tabelle einen Index auf jedem Feld in haben WHERE =
Klausel,
plus das Datumfeld. Ich vermute, da=DF dieses nicht der Fall ist, da =
die
Datenausgabe f=FCr eine mysqldatenbank ziemlich klein ist. Blick auf =
den
EXPLAIN SELECT, zu sehen, was Indizes f=FCr eine Frage verwendet werden.
Andy
> -----Original Message-----
> From: Nuno Pereira [mailto:nuno.pereira@carclasse.pt]
> Sent: 29 September 2005 11:24
> To: Marco Baar
> Cc: mysql@lists.mysql.com
> Subject: Re: Performance problem
>=20
> What?
>=20
> Please post in english.
>=20
> Marco Baar wrote:
Nutzdaten[color=dark
red]
Abfrage[color=darkre
d]
verh=E4ltnis zu[color=darkred]
> anderen
dauert 0,2-[color=darkred]
> 0,4
und[color=darkred]
> will
sind.[color=darkred]
> Sogar
Hintergrund[color=da
rkred]
> laufen
Betrieb[color=darkre
d]
werden.[color=darkred]
> Ist
auszustatten,[color=
darkred]
geht[color=darkred]
> und
>=20
> --
> Nuno Pereira
>=20
>=20
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: =
http://lists.mysql.com/mysql? unsub...ri
ve.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
| |
| Joerg Bruehe 2005-09-29, 7:24 am |
| 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/mysql? unsub...sie.nctu.edu.tw
| |
| Nuno Pereira 2005-09-29, 11:23 am |
| Marco Baar wrote:
> of cause your right.
>=20
> hello=20
> dear Nuno Pereira,
>=20
>=20
> I use mysql since 2 years and collected about 50 MB user data. I ve got=
a
> performance problem during selecting the main table. The table has abou=
t
> 200.000 rows and I make a simple select. I only select over 4 attribute=
s
> with "=3D", no joins, no subselects etc. The select needs 0,3 secs I th=
ink
> thats normal. But I had to change it and now it has an ORDER BY <DATE> =
LIMIT
> 50. Now the select take 3,5 secs and slows down my computer completely.=
(The
> sound stops)=20
>=20
>=20
> 2nd question:
> I wanna run my tool as a daimon or server in background. It must not sl=
owing
> down my PC, but it does during SQL command (e.g. bigger selects ). Is i=
t
> possible im multiuser mode to set a user to low priority. This user is =
the
> daimon so it can run in background without making problems.
>=20
> So long
> Marco Baar
> Germany
>=20
>=20
>=20
age[color=darkred]
zu[color=darkred]
t[color=darkred]
[color=darkred]
d.[color=darkred]
[color=darkred]
n.[color=darkred]
atten,[color=darkred
]
eht[color=darkred]
>=20
>=20
Maybe a post in the list would be good...
1st question)
There are no miracles: Order the data takes time.
A solution would be to place indexes on the columns in the order by.
It would also help to run something like this from time to time: "ALTER=20
TABLE main_table ORBER BY order_columns". That would help to have the=20
rows ordered.
2nd question)
You can have limits on the accounts in terms of querys per hour, number=20
of connections, and thinks like that, not select priority. See this:=20
http://dev.mysql.com/doc/mysql/en/user-resources.html
Does it help?
--=20
Nuno Pereira
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
|
|
|
|
|