Help with subquery

Discuss and learn how to use TableTracker for table selection and NoteTracker for taking automated notes.

Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators

Re: Help with subquery

Postby BillGatesIII » Sat Jul 06, 2013 8:24 pm

Good point... What happens if you try another player id? Someone you have a lot of hands on.
BillGatesIII
 
Posts: 740
Joined: Fri Dec 16, 2011 6:50 pm

Re: Help with subquery

Postby sawwee » Sat Jul 06, 2013 8:34 pm

If I choose the id of the player I have the most hands (it's me actually), then the query runs in 1200 ms.
For the same player using "thsp_1.id_player = player_real.id_player" instead of the id it takes for ages, more than 1 million ms at the moment, and still running. :-(

Using "thsp_1.id_player = player_real.id_player" we actually join thps_1 to player_real, don't we? I suppose the joined table will be huge, and that's why the query runs so slowly. What do you think?
sawwee
 
Posts: 513
Joined: Thu Dec 18, 2008 11:59 pm

Re: Help with subquery

Postby BillGatesIII » Sun Jul 07, 2013 6:33 am

No, the tables are not joined.

I created a column in roughly the same structure as yours and it's performing fine. Please note that the subquery here is not necessary to get this result, I just wanted to show you how it's built.

Code: Select all
sum(case when exists
         (select 1
          from (select thps.amt_p_effective_stack
                from tourney_hand_player_statistics thps
                where thps.id_player = player_real.id_player
                and thps.id_hand = tourney_hand_player_statistics.id_hand
                and thps.flg_p_3bet) as tt
          where tt.amt_p_effective_stack < 500)
          then 1 else 0 end)
BillGatesIII
 
Posts: 740
Joined: Fri Dec 16, 2011 6:50 pm

Re: Help with subquery

Postby sawwee » Sun Jul 07, 2013 2:41 pm

Thank you very much, I'll try it very soon!
I really appreciate your help!
sawwee
 
Posts: 513
Joined: Thu Dec 18, 2008 11:59 pm

Previous

Return to TableTracker & NoteTracker

Who is online

Users browsing this forum: No registered users and 23 guests

cron
highfalutin