Re: postgres_fdw: using TABLESAMPLE to collect remote sample
От | Tomas Vondra |
---|---|
Тема | Re: postgres_fdw: using TABLESAMPLE to collect remote sample |
Дата | |
Msg-id | 3d719e62-64d2-5184-eebf-6128bcb398e2@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: postgres_fdw: using TABLESAMPLE to collect remote sample (Tomas Vondra <tomas.vondra@enterprisedb.com>) |
Ответы |
Re: postgres_fdw: using TABLESAMPLE to collect remote sample
|
Список | pgsql-hackers |
Hi, here's two minor postgres_fdw patches, addressing the two issues discussed last week. 1) 0001-Fix-stale-comment-in-postgres_fdw.patch The first one cleans up the comment referencing the sample rate adjustment. While doing that, I realized without the adjustment we should never get sample_rate outside the valid range because we do: if ((reltuples <= 0) || (targrows >= reltuples)) method = ANALYZE_SAMPLE_OFF; So I removed the clamping, or rather replaced it with an assert. 2) 0002-WIP-check-relkind-in-FDW-analyze.patch The second patch adds the relkind check, so that we only issue TABLESAMPLE on valid relation types (tables, matviews). But I'm not sure we actually need it - the example presented earlier was foreign table pointing to a sequence. But that actually works fine even without this patch, because fore sequences we have reltuples=1, which disables sampling due to the check mentioned above (because targrows >= 1). The other issue with this patch is that it seems wrong to check the relkind value locally - instead we should check this on the remote server, because that's where we'll run TABLESAMPLE. Currently there are no differences between versions, but what if we implement TABLESAMPLE for another relkind in the future? Then we'll either fail to use sampling or (worse) we'll try using TABLESAMPLE for unsupported relkind, depending on which of the servers has newer version. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Вложения
В списке pgsql-hackers по дате отправления: