mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
c0c6acdfa0
Include eval costs of local conditions in remote-estimate mode, and don't assume the remote eval cost is zero in local-estimate mode. (The best we can do with that at the moment is to assume a seqscan, which may well be wildly pessimistic ... but zero won't do at all.) To get a reasonable local estimate, we need to know the relpages count for the remote rel, so improve the ANALYZE code to fetch that rather than just setting the foreign table's relpages field to zero.
54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* postgres_fdw.h
|
|
* Foreign-data wrapper for remote PostgreSQL servers
|
|
*
|
|
* Portions Copyright (c) 2012-2013, PostgreSQL Global Development Group
|
|
*
|
|
* IDENTIFICATION
|
|
* contrib/postgres_fdw/postgres_fdw.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef POSTGRES_FDW_H
|
|
#define POSTGRES_FDW_H
|
|
|
|
#include "foreign/foreign.h"
|
|
#include "lib/stringinfo.h"
|
|
#include "nodes/relation.h"
|
|
#include "utils/rel.h"
|
|
|
|
#include "libpq-fe.h"
|
|
|
|
/* in connection.c */
|
|
extern PGconn *GetConnection(ForeignServer *server, UserMapping *user);
|
|
extern void ReleaseConnection(PGconn *conn);
|
|
extern unsigned int GetCursorNumber(PGconn *conn);
|
|
extern void pgfdw_report_error(int elevel, PGresult *res, bool clear,
|
|
const char *sql);
|
|
|
|
/* in option.c */
|
|
extern int ExtractConnectionOptions(List *defelems,
|
|
const char **keywords,
|
|
const char **values);
|
|
|
|
/* in deparse.c */
|
|
extern void classifyConditions(PlannerInfo *root,
|
|
RelOptInfo *baserel,
|
|
List **remote_conds,
|
|
List **param_conds,
|
|
List **local_conds,
|
|
List **param_numbers);
|
|
extern void deparseSimpleSql(StringInfo buf,
|
|
PlannerInfo *root,
|
|
RelOptInfo *baserel,
|
|
List *local_conds);
|
|
extern void appendWhereClause(StringInfo buf,
|
|
bool has_where,
|
|
List *exprs,
|
|
PlannerInfo *root);
|
|
extern void deparseAnalyzeSizeSql(StringInfo buf, Relation rel);
|
|
extern void deparseAnalyzeSql(StringInfo buf, Relation rel);
|
|
|
|
#endif /* POSTGRES_FDW_H */
|