PQL Query Language
Poker Query Language (PQL) provides a SQL-like syntax for performing complex poker analysis and calculations. This page covers the core syntax and functionality.
Basic Query Structure
PQL queries follow a familiar SQL-like structure:
SELECT [expressions] FROM [context] WHERE [conditions]
Core Components
- SELECT: Specifies what to calculate (equity, hand types, board analysis, etc.)
- FROM: Defines the poker context (players, boards, game type)
- WHERE: Applies additional filtering conditions
Basic Examples
Equity Calculation
select equity from hero='AhKh', villain='QQ+', board='Ah9s2c', game='holdem'
Hand Type Analysis
select handtype(flop) from hero='AsKs', board='AhKc2d', game='holdem'
Board Analysis
select boardsuitcount(river) from board='2s3sJh4c', game='holdem'
Players and Ranges
Hand Notation
- Specific hands:
'AhKh','AsKs','2c7d' - Wildcards:
'*'(any two cards) - Range notation:
'AA-TT','AK-AJ','QQ+'
Player Context
-- Two players
select equity from hero='AhKh', villain='QQ+', game='holdem'
-- Multiple players
select equity from hero='AhKh', villain1='QQ+', villain2='AK', game='holdem'
-- Player with specific position
select equity from hero='AhKh', button='*', sb='*', bb='QQ+', game='holdem'
Board States
Board Notation
- Flop:
board='Ah9s2c' - Turn:
board='Ah9s2c4d' - River:
board='Ah9s2c4d7h' - Preflop: No board specified or
board=''
Dynamic Boards
-- Average over all possible flops
select avg(equity) from hero='AhKh', villain='QQ+', game='holdem'
-- Specific flop texture
select equity from hero='AhKh', villain='QQ+', board='Ah9s2c', game='holdem'
Functions and Expressions
Equity Functions
equity- Player's equity percentagewins- Probability of winningties- Probability of tyingscoops- Probability of scooping (in split-pot games)
Hand Analysis Functions
handtype(street)- Hand type (pair, two pair, etc.)handrank(street)- Numerical hand rankinghirating(street)- High hand ratingbesthand(street)- Best 5-card hand
Board Analysis Functions
boardsuitcount(street)- Number of suits on boardboardranks(street)- Ranks present on boardpairedboard(street)- Whether board is pairedstraightboard(street)- Whether board has straight potentialflushboard(street)- Whether board has flush potential
Range Functions
inrange(hand, range)- Whether hand is in rangerangesize(range)- Number of combos in range
Advanced Queries
Aggregation
-- Average equity across all runouts
select avg(equity) from hero='AhKh', villain='QQ+', game='holdem'
-- Count of specific outcomes
select count(*) from hero='AhKh', villain='QQ+'
where handtype(river) = 'flush', game='holdem'
Conditional Analysis
-- Equity when hero makes a flush
select equity from hero='AhKh', villain='QQ+', board='As2s3s'
where handtype(river) = 'flush', game='holdem'
-- Board texture analysis
select avg(equity) from hero='AhKh', villain='QQ+'
where boardsuitcount(flop) >= 2, game='holdem'
Complex Expressions
-- Equity advantage calculation
select equity - 0.5 from hero='AhKh', villain='QQ+', game='holdem'
-- Conditional probability
select count(*) / total(*) from hero='AhKh', villain='QQ+'
where handtype(river) = 'straight', game='holdem'
Game Types
Supported Games
game='holdem'- Texas Hold'emgame='shortdeck'- Short Deck Hold'emgame='omaha'- Omaha (coming soon)
Game-Specific Features
-- Short Deck example
select equity from hero='AhKh', villain='QQ+', board='Ah9s6c', game='shortdeck'
-- Hold'em with dead cards
select equity from hero='AhKh', villain='QQ+', dead='AsKs', game='holdem'
Performance Tips
- Specify boards when possible - More specific queries run faster
- Use appropriate aggregation -
avg(),sum(),count()for statistical analysis - Filter early - Use WHERE clauses to reduce computation scope
- Reasonable ranges - Very wide ranges increase computation time
Next Steps
- Try these queries in the PQL Playground
- Explore more examples and use cases
- Check the function reference for complete documentation