Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type C ¶
type C struct {
// contains filtered or unexported fields
}
C is a query cache, keyed on SQL statement strings (which can contain placeholders).
A cache can be used by multiple threads in parallel; however each different context must use its own Session.
func (*C) Add ¶
func (c *C) Add(session *Session, d *CachedData)
Add adds an entry to the cache (possibly evicting some other entry). If the cache already has a corresponding entry for d.SQL, it is updated. Note: d.PrepareMetadata cannot be modified once this method is called.
type CachedData ¶
type CachedData struct {
SQL string
Memo *memo.Memo
// PrepareMetadata is set for prepare queries. In this case the memo contains
// unassigned placeholders. For non-prepared queries, it is nil.
PrepareMetadata *PrepareMetadata
// subqueries during planning (prior to de-correlation).
IsCorrelated bool
}
CachedData is the data associated with a cache entry.
type PrepareMetadata ¶
type PrepareMetadata struct {
// Note that AST may be nil if the prepared statement is empty.
parser.Statement
// StatementNoConstants is the statement string formatted without constants,
// suitable for recording in statement statistics.
StatementNoConstants string
// Provides TypeHints and Types fields which contain placeholder typing
// information.
tree.PlaceholderTypesInfo
// Columns are the types and names of the query output columns.
Columns colinfo.ResultColumns
// InferredTypes represents the inferred types for placeholder, using protocol
// identifiers. Used for reporting on Describe.
InferredTypes []oid.Oid
}
PrepareMetadata encapsulates information about a statement that is gathered during Prepare and is later used during Describe or Execute.
func (*PrepareMetadata) MemoryEstimate ¶
func (pm *PrepareMetadata) MemoryEstimate() int64
MemoryEstimate returns an estimation (in bytes) of how much memory is used by the prepare metadata.