PvP

Schema pogo_pvp: Little / Great / Ultra ranks. Rank 1 is best; display and search use 1–50.

Caps

pvp_cap lists CP and level caps. Level 51.0 is the best-buddy cap.

cap_id max_cp max_level League
0 500 50.0 Little
1 500 51.0 Little, best buddy
2 1500 50.0 Great
3 1500 51.0 Great, best buddy
4 2500 50.0 Ultra
5 2500 51.0 Ultra, best buddy

Identity keys

Integer hashes:

Column Meaning
stat_pool_hash Set of base stats that share one ranking table
evo_path_hash Set of forms on one evolution path
iv_key Packed IVs: (attack_iv << 20) \| (defense_iv << 10) \| stamina_iv
solo_stat_pool_hash Pool for the spawn form only (no evolution)

A spawn stores stat_pool_hash, solo_stat_pool_hash, evo_path_hash, and iv_key. Those columns can be null until enrich runs.

Tables

stat_pool is one row per stat_pool_hash. stat_pool_member lists the members of that pool (hash plus base_attack, base_defense, base_stamina).

evo_path is one row per evo_path_hash. evo_path_member lists forms on the path (base_stat_key is packed base stats for that form). evo_path_closure is every evolution hop on a path (hops ≥ 1), plus to_solo_stat_pool_hash. evo_path_edge is the hops = 1 view of that table.

evo_scenario maps a live form to hashes. The key is (pokemon_id, form_id, gender, costume_proxy). The proxy classifies evolution behavior for that species/form: 0 is the ordinary class, a positive costume ID is a node-specific allow-exception, and -1 is a blocked no-evolve class.

stat_ranking is the rank table. Its primary key is (stat_pool_hash, iv_key, cap_id).

Column Meaning
rank 1 is best
level Level at that rank
cp CP at that rank
percent_max_stats_product Percent of the best product
achiever_stat_key Which member of the pool hits this rank

Join from a spawn

For default (line) ranks, join the spawn's pool hash:

SELECT r.cap_id, r.rank, r.level, r.cp
FROM pogo_live.sub_v2_spawns AS s
JOIN pogo_pvp.stat_ranking AS r
  ON r.stat_pool_hash = s.stat_pool_hash
 AND r.iv_key = s.iv_key
 AND s.level <= r.level
WHERE s.expires > now()
  AND r.cap_id = 2
  AND r.rank <= 10;

Use solo_stat_pool_hash for the spawn form only. Keep s.level <= r.level: a spawn above the rank level isn't legal for that cap. On large scans, also bound cap_id or rank. Hashes are null until enrich runs.

costume_proxy function

pogo_pvp.costume_proxy(pokemon_id, form_id, costume_id) returns the proxy for a scenario key. Use it when you build that key from live columns.

Live NULL costume → class 0. Other costumes can also map to 0 if they evolve the same way. Don't write -1 into live costume columns.

pvp_derived_meta

Singleton id = 1: gm_batch_id, graph_fingerprint, ranking_fingerprint, ranking_algo_version, ranking_input_sha256, modified. Compare modified even when fingerprints match (forced rebuild). Notify: cuno_wake_pogo_pvp. Listener procedure.