Storage optimization (GraphQL)

Related queries and mutations in Performance and cost. Each has its own section.

Queries

getStorageOptimizationCandidates (query)

getStorageOptimizationCandidates is a query in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Get tables that are candidates for storage optimization, largest first unless 'orderBy' or 'orderDirection' says otherwise. Scoped to a single warehouse when 'resourceId' is given, otherwise to every warehouse in the account. Both cases are narrowed by the account's cost agent warehouse scope: candidates on warehouses outside the scope are not returned.

Arguments

ArgumentTypeDescription
resourceIdUUIDUUID of the warehouse to scan for optimization candidates. Omit to return candidates across the warehouses in the account's cost agent warehouse scope. Passing a warehouse outside that scope returns an empty page with totalCount 0 and no error, even when the warehouse is valid and accessible.
firstIntMaximum number of candidates to return per page (default: 50) Default: 50.
afterStringCursor from a previous page's endCursor to fetch the next page. A cursor carries the sort it was issued under. Reusing one after 'orderBy' or 'orderDirection' changes is rejected; start again from the first page instead.
filterStorageOptimizationCandidatesFilterOptional filters applied to the candidate results
orderByStorageOptimizationSortFieldField to sort candidates by, applied to every candidate matching the filter rather than to the returned page alone. Defaults to totalByteCount. A candidate with no recorded size sorts as zero bytes. A candidate with no risk tier sorts last in either direction. A candidate that was never read sorts as the stalest. tableCategory ranks by cleanup safety rather than alphabetically, from safest to remove to least safe: temporary, ad_hoc, archive_snapshot, other, production. Safest-first is the ASC order; 'orderDirection' defaults to DESC. An unrecognised or unset category sorts last in either direction. tableName sorts by table name, breaking ties on project then dataset; fullTableId sorts the fully qualified identifier ('project:dataset.table') instead. Either way an unset name sorts last in either direction.
orderDirectionStorageOptimizationSortDirectionDirection to sort 'orderBy' in. Defaults to DESC.

Returns

StorageOptimizationCandidatesResult

Example

query GetStorageOptimizationCandidates {
  getStorageOptimizationCandidates {
    totalCount
    totalByteCountSum
    breakdownByRiskLevel
  }
}

Types used only by getStorageOptimizationCandidates

StorageOptimizationCandidate

Object type. A table that is a candidate for storage optimization.

FieldTypeDescription
projectNameString
datasetNameString
tableNameString
tableTypeString
latestUpdateDateTime
latestReadDateTime
latestWriteDateTime
latestQueryDateTime
isPeriodicMetadataBoolean
totalReadsFloat
totalWritesFloat
totalUsersFloat
totalReadingUsersFloat
totalWritingUsersFloat
importanceScoreFloat
isImportantBoolean
criticalityString
degreeInFloat
degreeOutFloat
nodeTypeString
isMonitoredBoolean
hasActiveMonitorBoolean
isExcludedBoolean
createdTimeDateTime
discoveredTimeDateTime
lastObservedDateTime
byteCountShareFloat
rowCountShareFloat
wastePatternString
tableCategoryString
riskTierInt
fullTableIdString!Fully qualified table identifier (project:dataset.table)
resourceUuidString!UUID of the warehouse this table belongs to
mconString!Monte Carlo object name — unique table identifier
daysSinceLatestReadFloatNumber of days since the table was last read (computed at query time)
totalRowCountFloatMost recent row count for this table
totalByteCountFloatMost recent byte count for this table
queryLogDaysIntDays, out of the last 30, on which Monte Carlo collected query logs for this table's warehouse. Read and write dates cover only those days, so a warehouse with fewer days can show a table as unread when its reads were not collected. Null when not yet measured.
tickets[StorageCandidateTicket!]!Tickets created covering this candidate (empty if none).
StorageOptimizationCandidatesFilter

Input object type. Optional filters applied to storage optimization candidate results.

FieldTypeDescription
databaseNames[String!]Filter candidates to tables whose database/project/catalog name is in this list. Exact match. Null or empty list applies no filter.
schemaNames[String!]Filter candidates to tables whose schema/dataset name is in this list. Exact match. Null or empty list applies no filter.
tiers[Int!]Filter candidates to the given safety tiers (0 = safest to remove, 5 = highest risk). Null or empty list applies no filter.
tableCategories[String!]Filter candidates to the given derived table categories (temporary, ad_hoc, archive_snapshot, other, production). Null or empty list applies no filter.
nameSearchStringCase-insensitive substring match on the table name. Null or empty string applies no filter.
domainIds[UUID!]Filter candidates to tables assigned to any of these domains. Restricted to domains the caller can access. Null or empty list applies no filter.
StorageOptimizationCandidatesResult

Object type.

FieldTypeDescription
nodes[StorageOptimizationCandidate!]!Storage optimization candidates for the current page
totalCountInt!Total number of candidates across all pages
totalByteCountSumFloat!Summed 'totalByteCount' of every candidate matching the current filter, not just the returned page. Candidates with no recorded size do not contribute, and an empty result reports 0.
pageInfoStorageOptimizationPageInfo!Pagination information
breakdownByRiskLevel[Int!]!Per-tier candidate counts for the current filter, as a 6-element array indexed by safety tier (0 = safest to remove, 5 = highest risk). Empty tiers report 0.
StorageOptimizationSortField

Enum type. Field a storage optimization candidate list is sorted by.

ValueDescription
totalByteCount
riskTier
daysSinceLatestRead
tableCategory
tableName
fullTableId

Related types

DateTime, StorageCandidateTicket, StorageOptimizationPageInfo, StorageOptimizationSortDirection, UUID

getStorageUnusedTables (query)

getStorageUnusedTables is a query in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Tables Cost Agent judged unused in the account's latest run that listed them, largest first unless 'orderBy' or 'orderDirection' says otherwise. Each table says whether it is in a finding, and why not when it isn't. Narrowed to the caller's domains and the account's cost agent warehouse scope. Not available to the free tier of Performance & Cost Agent.

Arguments

ArgumentTypeDescription
firstIntTables per page, at most 1000 (default: 50). Default: 50.
afterString'endCursor' of the previous page. A cursor from another sort is rejected; start again from the first page.
filterStorageUnusedTablesFilter
orderByStorageUnusedTableSortFieldDefaults to sizeBytes.
orderDirectionStorageOptimizationSortDirectionDefaults to DESC.

Returns

StorageUnusedTablesResult!

Example

query GetStorageUnusedTables {
  getStorageUnusedTables {
    totalCount
    totalSizeBytes
    totalMonthlyCostUsd
    asOfTime
    mode
    notice
  }
}

Types used only by getStorageUnusedTables

StorageUnusedTable

Object type. A table Cost Agent judged unused in its run. Names are customer identifiers: show them as
plain text.

FieldTypeDescription
mconString!Monte Carlo object name of the table.
warehouseUuidUUID!The table's warehouse.
platformString!The warehouse's platform.
fullTableIdString!
databaseNameString
schemaNameString
tableNameString
sizeBytesFloat!
monthlyCostUsdFloatStorage cost a month at the price 'priceLabel' names. Null without a price.
priceSourceStringWhere the price came from: STANDARD, CUSTOMER or BILLED_AVERAGE.
priceLabelStringThe price and its source in words, e.g. '$23.00/TB-month, standard price'.
lastUsedTimeDateTimeThe latest read, write or data change seen. Null when none was seen.
isLastUsedFirstSeenBoolean!Whether 'lastUsedTime' is the date Monte Carlo first saw the table, not a use it saw. Always false for now, because Monte Carlo doesn't record first-seen dates yet.
downstreamCountIntAssets directly downstream: tables and reports. Null when unknown.
storageShareFloatThe table's share of the bytes of every table in its warehouse, from 0 to 1. Null when unknown.
statusStorageUnusedTableStatus!
dropReasonStringWhy Cost Agent didn't make the table's schema a finding, when 'status' is DROPPED: KEPT_ON_PURPOSE, USED_OUTSIDE_MC, EVIDENCE_MISREAD or WOULD_HURT_USERS.
findingKeyStringThe stable key of the run's finding that lists the table, when 'status' is IN_FINDING.
tickets[StorageCandidateTicket!]!Tickets created covering this table (empty if none).
StorageUnusedTableSortField

Enum type. Field the unused tables are sorted by, named after the field it sorts. A table without a value sorts last in either direction. tableName breaks ties on database, then schema.

ValueDescription
sizeBytes
monthlyCostUsd
lastUsedTime
storageShare
downstreamCount
tableName
StorageUnusedTableStatus

Enum type. Whether an unused table is in one of the run's findings, and why not when it isn't.

IN_FINDING: in one of the run's findings. DROPPED: Cost Agent reviewed the table's schema and
didn't make it a finding; 'dropReason' says why. UNDER_MINIMUM_SAVING: the schema's saving is
under the minimum a finding shows. OUTSIDE_TOP_FINDINGS: the schema's finding ranked below
the run's cap on findings. INSUFFICIENT_HISTORY: the warehouse's query logs miss days, so the
table can't be proven unused. UNKNOWN: a status this version of the API doesn't know.

ValueDescription
IN_FINDING
DROPPED
UNDER_MINIMUM_SAVING
OUTSIDE_TOP_FINDINGS
INSUFFICIENT_HISTORY
UNKNOWN
StorageUnusedTableWarehouse

Object type. A warehouse Cost Agent looked at for unused tables in the run.

FieldTypeDescription
warehouseUuidUUID!
platformString!
statusStorageUnusedTableWarehouseStatus!
queryLogDaysIntDays, out of the last 30, with query logs. Null when not measured.
unusedTotalInt!Unused tables found among the tables checked.
leftOutInt!Unused tables beyond the largest ones the run lists, so not listed. 0 when the warehouse's status lists no tables. Otherwise the run lists 'unusedTotal' minus 'leftOut' of them.
isLeftOutLowerBoundBoolean!Whether only the warehouse's largest tables were checked, so 'unusedTotal' and 'leftOut' are lower bounds.
StorageUnusedTableWarehouseStatus

Enum type. Whether a warehouse's unused tables were listed, and why not when they weren't.

LISTED: its unused tables are listed. INSUFFICIENT_HISTORY: query logs on too few days, so its
unused tables are listed with status INSUFFICIENT_HISTORY. NO_QUERY_HISTORY: no query logs in
the window; none are listed. NOT_SUPPORTED: its platform's query logs can't prove a table
unused yet; none are listed. UNAVAILABLE: its tables couldn't be read in this run; none are
listed. UNKNOWN: a status this version of the API doesn't know.

ValueDescription
LISTED
INSUFFICIENT_HISTORY
NO_QUERY_HISTORY
NOT_SUPPORTED
UNAVAILABLE
UNKNOWN
StorageUnusedTablesFilter

Input object type. Filters on the unused tables. A null or empty value applies no filter.

FieldTypeDescription
warehouseIds[UUID!]
databaseNames[String!]Exact database or project names.
schemaNames[String!]Exact schema or dataset names.
statuses[StorageUnusedTableStatus!]
nameSearchStringCase-insensitive substring of the table name, at most 200 characters.
domainIds[UUID!]Tables assigned to any of these domains, within the domains the caller can access.
StorageUnusedTablesNotice

Enum type. What to tell the viewer about the account's latest Cost Agent run.

STORAGE_OFF: the latest run left storage findings out, so it listed no tables. RUN_FAILED: the
latest run ended in an error; the tables are from the run 'asOfTime' names. NOT_LISTED: the
latest run didn't list unused tables; the tables are from the run 'asOfTime' names.
NONE_FOUND: the run found no unused tables.

ValueDescription
STORAGE_OFF
RUN_FAILED
NOT_LISTED
NONE_FOUND
StorageUnusedTablesResult

Object type.

FieldTypeDescription
nodes[StorageUnusedTable!]!
totalCountInt!Tables matching the filter, across all pages.
totalSizeBytesFloat!Summed size of every table matching the filter.
totalMonthlyCostUsdFloat!Summed monthly cost of every table matching the filter. Tables without a price don't contribute.
pageInfoStorageOptimizationPageInfo!
asOfTimeDateTimeThe end of the data the tables' run read. Null when the account has no run that listed unused tables, or the caller can't see that run.
modeStorageUnusedTablesRunModeThe tables' run's mode. Null when the account has no run that listed unused tables, or the caller can't see that run.
noticeStorageUnusedTablesNoticeWhat to tell the viewer about the latest run. Null when nothing.
warehouses[StorageUnusedTableWarehouse!]!The warehouses the tables' run looked at, including those with no tables.
StorageUnusedTablesRunMode

Enum type. Who is shown the run's findings. ON: customers. SHADOW: only Monte Carlo users, who are the
only callers given a SHADOW run's tables.

ValueDescription
ON
SHADOW

Related types

DateTime, StorageCandidateTicket, StorageOptimizationPageInfo, StorageOptimizationSortDirection, UUID

Mutations

createJiraTicketForStorageCandidates (mutation)

createJiraTicketForStorageCandidates is a mutation in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Create a Jira ticket for a set of storage-optimization candidates or unused tables.

Arguments

ArgumentTypeDescription
candidateMcons[String!]!MCONs of the selected tables: storage optimization candidates, or unused tables from getStorageUnusedTables.
detailsCreateJiraStorageTicketInput!

Returns

CreateJiraTicketForStorageCandidates

Example

mutation CreateJiraTicketForStorageCandidates($candidateMcons: [String!]!, $details: CreateJiraStorageTicketInput!) {
  createJiraTicketForStorageCandidates(candidateMcons: $candidateMcons, details: $details) {
    ticket {
      id
      provider
      identifier
      url
      coveredMcons
      createdTime
    }
  }
}

Types used only by createJiraTicketForStorageCandidates

CreateJiraStorageTicketInput

Input object type. Jira ticket details for a set of storage-optimization candidates.

FieldTypeDescription
integrationIdUUID!UUID of the Jira integration to create the ticket under.
projectInt!Jira project id.
issuetypeInt!Jira issue-type id.
summaryString!Ticket summary (must be non-empty).
descriptionStringTicket description (Markdown).
fieldsJSONStringAdditional Jira fields keyed by field id (e.g. required custom fields).
CreateJiraTicketForStorageCandidates

Object type.

FieldTypeDescription
ticketStorageCandidateTicket

Related types

JSONString, StorageCandidateTicket, UUID

createLinearTicketForStorageCandidates (mutation)

createLinearTicketForStorageCandidates is a mutation in the Monte Carlo GraphQL API, in Performance and cost. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.

Status: Experimental

Create a Linear issue for a set of storage-optimization candidates or unused tables.

Arguments

ArgumentTypeDescription
candidateMcons[String!]!MCONs of the selected tables: storage optimization candidates, or unused tables from getStorageUnusedTables.
detailsCreateLinearStorageTicketInput!

Returns

CreateLinearTicketForStorageCandidates

Example

mutation CreateLinearTicketForStorageCandidates($candidateMcons: [String!]!, $details: CreateLinearStorageTicketInput!) {
  createLinearTicketForStorageCandidates(candidateMcons: $candidateMcons, details: $details) {
    ticket {
      id
      provider
      identifier
      url
      coveredMcons
      createdTime
    }
  }
}

Types used only by createLinearTicketForStorageCandidates

CreateLinearStorageTicketInput

Input object type. Linear ticket details for a set of storage-optimization candidates.

FieldTypeDescription
titleString!Ticket title (must be non-empty).
descriptionStringTicket description (Markdown).
teamIdStringLinear team ID; defaults to the integration's default team.
CreateLinearTicketForStorageCandidates

Object type.

FieldTypeDescription
ticketStorageCandidateTicket

Related types

StorageCandidateTicket

Source: The GraphQL API reference

This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.