hub

package
v0.0.27-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2021 License: PostgreSQL Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

Hub :: structure representing plugin hub

func GetHub

func GetHub() (*Hub, error)

GetHub :: return hub singleton if there is an existing hub singleton instance return it, otherwise create it if a hub exists, but a different pluginDir is specified, reinitialise the hub with the new dir

func (*Hub) Close

func (h *Hub) Close()

shutdown all plugin clients

func (*Hub) Explain

func (h *Hub) Explain(columns []string, quals []*proto.Qual, sortKeys []string, verbose bool, opts types.Options) ([]string, error)

Explain :: hook called on explain.

Returns:
    An iterable of strings to display in the EXPLAIN output.

func (*Hub) GetPathKeys

func (h *Hub) GetPathKeys(opts types.Options) ([]types.PathKey, error)

GetPathKeys :: Method called from the planner to add additional Path to the planner.

By default, the planner generates an (unparameterized) path, which
can be reasoned about like a SequentialScan, optionally filtered.
This method allows the implementor to declare other Paths,
corresponding to faster access methods for specific attributes.
Such a parameterized path can be reasoned about like an IndexScan.
For example, with the following query::
    select * from foreign_table inner join local_table using(id);
where foreign_table is a foreign table containing 100000 rows, and
local_table is a regular table containing 100 rows.
The previous query would probably be transformed to a plan similar to
this one::
    ┌────────────────────────────────────────────────────────────────────────────────────┐
    │                                     QUERY PLAN                                     │
    ├────────────────────────────────────────────────────────────────────────────────────┤
    │ Hash Join  (cost=57.67..4021812.67 rows=615000 width=68)                           │
    │   Hash Cond: (foreign_table.id = local_table.id)                                   │
    │   ->  Foreign Scan on foreign_table (cost=20.00..4000000.00 rows=100000 width=40)  │
    │   ->  Hash  (cost=22.30..22.30 rows=1230 width=36)                                 │
    │         ->  Seq Scan on local_table (cost=0.00..22.30 rows=1230 width=36)          │
    └────────────────────────────────────────────────────────────────────────────────────┘
But with a parameterized path declared on the id key, with the knowledge that this key
is unique on the foreign side, the following plan might get chosen::
    ┌───────────────────────────────────────────────────────────────────────┐
    │                              QUERY PLAN                               │
    ├───────────────────────────────────────────────────────────────────────┤
    │ Nested Loop  (cost=20.00..49234.60 rows=615000 width=68)              │
    │   ->  Seq Scan on local_table (cost=0.00..22.30 rows=1230 width=36)   │
    │   ->  Foreign Scan on remote_table (cost=20.00..40.00 rows=1 width=40)│
    │         Filter: (id = local_table.id)                                 │
    └───────────────────────────────────────────────────────────────────────┘
Returns:
    A list of tuples of the form: (key_columns, expected_rows),
    where key_columns is a tuple containing the columns on which
    the path can be used, and expected_rows is the number of rows
    this path might return for a simple lookup.
    For example, the return value corresponding to the previous scenario would be::
        [(('id',), 1)]

func (*Hub) GetRelSize

func (h *Hub) GetRelSize(columns []string, quals []*proto.Qual, opts types.Options) (types.RelSize, error)

GetRelSize :: Method called from the planner to estimate the resulting relation size for a scan.

It will help the planner in deciding between different types of plans,
according to their costs.
Args:
    columns (list): The list of columns that must be returned.
    quals (list): A list of Qual instances describing the filters
        applied to this scan.
Returns:
    A struct of the form (expected_number_of_rows, avg_row_width (in bytes))

func (*Hub) GetSchema

func (h *Hub) GetSchema(remoteSchema string, localSchema string) (*proto.Schema, error)

GetSchema :: return the schema for a name. Load the plugin for the connection if needed

func (*Hub) LoadConnectionConfig

func (h *Hub) LoadConnectionConfig() (bool, error)

LoadConnectionConfig :: load the connection config and return whether it has changed

func (*Hub) Scan

func (h *Hub) Scan(rel *types.Relation, columns []string, quals []*proto.Qual, opts types.Options) (Iterator, error)

Scan :: Start a table scan. Returns an iterator

func (*Hub) SetConnectionConfig

func (h *Hub) SetConnectionConfig(remoteSchema string, localSchema string) error

send the locally cached connection config to the plugin

type Iterator

type Iterator interface {
	// Next returns next row. Nil slice means there is no more rows to scan.
	Next() (map[string]interface{}, error)
	// Close stops an iteration and frees any resources.
	Close() error
}

Iterator is an interface for table scanner implementations.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL