Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions server/tables/pgcatalog/pg_catalog_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/dolthub/doltgresql/core/id"
"github.com/dolthub/doltgresql/core/sequences"
"github.com/dolthub/doltgresql/server/functions"
pgtypes "github.com/dolthub/doltgresql/server/types"
)

// pgNamespace represents a row in the pg_namespace table.
Expand All @@ -48,6 +47,9 @@ type pgCatalogCache struct {
// pg_classes
pgClasses *pgClassCache

// pg_type
pgTypes *pgTypeCache

// pg_constraints
pgConstraints *pgConstraintCache

Expand All @@ -72,10 +74,6 @@ type pgCatalogCache struct {
views []sql.ViewDefinition
viewSchemas []string

// pg_types
types []*pgtypes.DoltgresType
schemasToOid map[string]id.Namespace

// pg_tables
tables []sql.Table
systemTables []doltdb.TableName
Expand Down Expand Up @@ -103,6 +101,25 @@ func (p pgClassCache) getIndex(name string) *inMemIndexStorage[*pgClass] {

var _ BTreeStorageAccess[*pgClass] = &pgClassCache{}

type pgTypeCache struct {
types []*pgType
nameIdx *inMemIndexStorage[*pgType]
oidIdx *inMemIndexStorage[*pgType]
}

func (p pgTypeCache) getIndex(name string) *inMemIndexStorage[*pgType] {
switch name {
case PgOidIndexName:
return p.oidIdx
case PgTypnameIndexName:
return p.nameIdx
default:
panic("unknown pg_class index: " + name)
Comment thread
NathanGabrielson marked this conversation as resolved.
Outdated
}
}

var _ BTreeStorageAccess[*pgType] = &pgTypeCache{}

// pgIndexCache holds cached data for the pg_index table, including two btree indexes for fast lookups by index OID
type pgIndexCache struct {
indexes []*pgIndex
Expand Down
Loading
Loading