You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have approximately 20 million rows in my database and I have the Play table indexed on game_id and play_id.
I am running the following query in R:
system.time(sample_play <- dbGetQuery(nbacon,
paste0("SELECT p.player_id, p.lastname,
p.firstname, p.jersey, p.x_loc, p.y_loc, p.game_clock, p.shot_clock, p.home_description,
p.visitor_description, t.teamname, t.teamabbrev
FROM Play p
INNER JOIN Team t ON
p.team_id = t.team_id
WHERE game_id = '0021500290' AND play_id = 218)))
This returns 7150 rows of 12 variables.
The total time it takes is:
user system elapsed
0.023 0.014 8.489
It seems awfully long to fetch 7150 rows in 8.5 seconds.
That being said, I am running the exact same query on MySQLWorkbench and it takes:
Duration / Fetch Time
0.734 sec / 0.0039 sec
Any ideas on how to speed this up? All help is greatly appreciated!
The text was updated successfully, but these errors were encountered:
imcullan
changed the title
Very slow queries
Very slow SELECT queries
Jan 18, 2017
Hello,
Below is my sessioninfo():
I have approximately 20 million rows in my database and I have the Play table indexed on game_id and play_id.
I am running the following query in R:
This returns 7150 rows of 12 variables.
The total time it takes is:
It seems awfully long to fetch 7150 rows in 8.5 seconds.
That being said, I am running the exact same query on MySQLWorkbench and it takes:
Any ideas on how to speed this up? All help is greatly appreciated!
The text was updated successfully, but these errors were encountered: