1
为什么PostgreSQL选择较昂贵的联接顺序?
PostgreSQL使用默认值,加上 default_statistics_target=1000 random_page_cost=1.5 版 PostgreSQL 10.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 6.4.0) 6.4.0, 64-bit 我已经吸尘并进行了分析。该查询非常简单: SELECT r.price FROM account_payer ap JOIN account_contract ac ON ap.id = ac.account_payer_id JOIN account_schedule "as" ON ac.id = "as".account_contract_id JOIN schedule s ON "as".id = s.account_schedule_id JOIN rate r ON s.id = r.schedule_id WHERE …