Custom Query

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Custom Query

Postby bodhisoma » Sun Nov 24, 2013 5:06 pm

Wanted to make a stat that was something like "Given the last 10 hands, how many were steal attempts between 8 and 20bb live stacks."

Kraada and I spoke about it some time ago but going back to his instructions, I think we were discussing a custom report, I want to do this as a stat.

Possible?
bodhisoma
 
Posts: 231
Joined: Mon Sep 21, 2009 9:49 am

Re: Custom Query

Postby WhiteRider » Mon Nov 25, 2013 4:38 am

Individual stats can't get information just from the last X hands. If this stat is to be used in the Hud while playing then we may be able to do something by using the time the hands were played.
Are you using PT3 or PT4?
WhiteRider
Moderator
 
Posts: 53972
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Custom Query

Postby bodhisoma » Mon Nov 25, 2013 9:09 am

PT4, latest build (4.10.5 if I'm not mistaken).
bodhisoma
 
Posts: 231
Joined: Mon Sep 21, 2009 9:49 am

Re: Custom Query

Postby kraada » Mon Nov 25, 2013 10:57 am

I don't think the PT4 live table has enough information to make this particular stat.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Custom Query

Postby bodhisoma » Mon Nov 25, 2013 11:32 am

In pseudo sql, why not something like

SELECT FROM `table` WHERE 'blinds' >= 8 AND 'blinds' <= 20 ORDER BY timestamp LIMIT 0, 10

...?
bodhisoma
 
Posts: 231
Joined: Mon Sep 21, 2009 9:49 am

Re: Custom Query

Postby kraada » Mon Nov 25, 2013 2:10 pm

Stats are kept per player per hand; the amount of table-wide data is actually fairly small (take a look at the cash_hand_summary table vs the cash_hand_player_statistics table in PGAdmin).
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Custom Query

Postby bodhisoma » Mon Nov 25, 2013 2:39 pm

I feel bad for asking this because when you say it can't be done, I believe you. I just don't understand why table-wide data is needed.

I can have a stat that tells me how many times they attempted to steal between 8 and 20bb, why would sorting the query results by timestamp and limiting the return lines involve table data?

Or are you saying each entry doesn't have a timestamp?
bodhisoma
 
Posts: 231
Joined: Mon Sep 21, 2009 9:49 am

Re: Custom Query

Postby kraada » Mon Nov 25, 2013 3:13 pm

It does, but the index doesn't sort by it. So the query would have to traverse the table which would take a lot longer than you'd otherwise expect. It's possible in the sense that it would work but not in the sense that it would work with reasonable results timewise.
kraada
Moderator
 
Posts: 54431
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 12 guests

cron
highfalutin