SQL SELECT dauert über Partitionierung extrem lange

Xidus

Lieutenant
Registriert
Jan. 2011
Beiträge
727
Hallo Liebe Community,

mein Problem ist das wenn ich über die Parent Relation gehe der Query extream viel länger brauch als würde ich einfach alle Child Relationen abfragen.

Mein Query:
Code:
SELECT g.gameID
FROM gamefellowplayers.gamefellowplayers_euw gfp
JOIN games.games_euw g ON g.gameId = gfp.gameID
WHERE gfp.summonerId=? AND g.loaded >=1
ORDER BY g.gameID DESC LIMIT 15;
Planning time: 20.705 ms
Execution time: 2549.291 ms

Code:
SELECT g.gameID
FROM gamefellowplayers.gamefellowplayers_euw_24 gfp
JOIN games.games_euw_24 g ON g.gameId = gfp.gameID
WHERE gfp.summonerId=? AND g.loaded >=1
ORDER BY g.gameID DESC LIMIT 15;
Planning time: 0.355 ms
Execution time: 0.180 ms

gamefellowplayers
INDEX summonerid
PRIMARY gameid, participantid

games
PRIMARY gameid

Kann ich das irgendwie optimieren (oder mach ich was falsch)?


Der Aufbau der Relationen sieht so aus:
relation_region_gameid/100000000
 
Hallo Xidus,

Bist Du wirklich sicher, dass Deine DB partitioniert ist? Um was für ein DBMS handelt es sich? Definition der Attribute – Datentyp etc.? Nähere Info wäre hilfreich.
 
Ja ist 100% partitioniert.

Die struktur ist so:

public.gamefellowplayers
->gamefellowplayers.gamefellowplayers_euw
->->gamefellowplayers.gamefellowplayers_euw_0
->->gamefellowplayers.gamefellowplayers_euw_1
->-> ...
->->gamefellowplayers.gamefellowplayers_na_0
->-> ...
-> ...

Ich nutze Postgreesql 9.4.

gameID = long
loaded = int
summonerId = long
 
Zurück
Oben