Documentation
¶
Index ¶
- type Hub
- func (h *Hub) Abort()
- func (h *Hub) AddIterator(iterator Iterator)
- func (h *Hub) Close()
- func (h *Hub) Explain(columns []string, quals []*proto.Qual, sortKeys []string, verbose bool, ...) ([]string, error)
- func (h *Hub) GetPathKeys(opts types.Options) ([]types.PathKey, error)
- func (h *Hub) GetRelSize(columns []string, quals []*proto.Qual, opts types.Options) (types.RelSize, error)
- func (h *Hub) GetSchema(remoteSchema string, localSchema string) (*proto.Schema, error)
- func (h *Hub) LoadConnectionConfig() (bool, error)
- func (h *Hub) RemoveIterator(iterator Iterator)
- func (h *Hub) Scan(columns []string, quals []*proto.Qual, opts types.Options) (Iterator, error)
- func (h *Hub) SetConnectionConfig(remoteSchema string, localSchema string) error
- type Iterator
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 ¶
GetHub returns a 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) Abort ¶ added in v0.0.35
func (h *Hub) Abort()
Abort shuts down currently running queries
func (*Hub) AddIterator ¶ added in v0.0.35
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 ¶
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 ¶
GetSchema returns the schema for a name. Load the plugin for the connection if needed
func (*Hub) LoadConnectionConfig ¶
LoadConnectionConfig :: load the connection config and return whether it has changed
func (*Hub) RemoveIterator ¶ added in v0.0.35
type Iterator ¶
type Iterator interface {
// returns the connection name that this iterator uses.
// for cacheIterators, this will be an empty string
ConnectionName() string
// 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.