Skip to main content

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 percentage
  • wins - Probability of winning
  • ties - Probability of tying
  • scoops - Probability of scooping (in split-pot games)

Hand Analysis Functions

  • handtype(street) - Hand type (pair, two pair, etc.)
  • handrank(street) - Numerical hand ranking
  • hirating(street) - High hand rating
  • besthand(street) - Best 5-card hand

Board Analysis Functions

  • boardsuitcount(street) - Number of suits on board
  • boardranks(street) - Ranks present on board
  • pairedboard(street) - Whether board is paired
  • straightboard(street) - Whether board has straight potential
  • flushboard(street) - Whether board has flush potential

Range Functions

  • inrange(hand, range) - Whether hand is in range
  • rangesize(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'em
  • game='shortdeck' - Short Deck Hold'em
  • game='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

  1. Specify boards when possible - More specific queries run faster
  2. Use appropriate aggregation - avg(), sum(), count() for statistical analysis
  3. Filter early - Use WHERE clauses to reduce computation scope
  4. Reasonable ranges - Very wide ranges increase computation time

Next Steps