I'have an issue with a MySql Query
Two tables.
Persons tabel (25000 records)
persid (Primary key)
voornaam
tussenvoegsel
achternaam (index)
Line Ups tabel (370000 records)
Opstelkey (Primary key)
wid
Persid
volgorde
gesp
gesc
SELECT sum(o.gesc) as totgescoord,p.achternaam
FROM opstelere1 o,personen1 p
where o.persid=p.persid
group by o.persid
Result above Query 6809 totaal, Query duration 0,0176 seconds
Adding Order By, the Query runs a lot slower.
SELECT sum(o.gesc) as totgescoord,p.achternaam
FROM opstelere1 o,personen1 p
where o.persid=p.persid
group by o.persid
order by totgescoord desc
Result this Query 6809 totaal, Query duratiob 2,7740 seconds
Query only on Line Ups Table with use of persid
SELECT o.persid,sum(o.gesc) as totgescoord
FROM opstelere1 o
group by o.persid
order by totgescoord desc
Resultaat Query 6809 totaal, Query duration 0,1732 seconds But it's nice to see a name instead of a persid ;-)