Ever Platform
RoadmapIdeasDeveloper ToolsSDK
  • About Ever Platform
  • Sandbox endpoint
  • Quick Start
  • Use cases
    • Infrastructure Provider
      • Projects
    • Community-driven development
      • Roadmap
        • Discussions
      • Your ideas
      • DevNet Giver(Faucet)
    • Custom development
      • Our clients
  • Products
    • Evercloud
      • Networks Endpoints
      • Get Started
      • GraphQL API documentation
      • Testnet Faucets
      • About data proofs in Cloud
      • SLA
      • HTTP notifications
    • Dedicated Cloud/Node
    • Dapp Server (DS)
    • Simple Emulator (SE)
      • Endpoint
    • Network Emulator (NE)
    • Functionality comparison
  • Samples
    • GraphQL Samples
      • Send message
      • Network Config
      • Blocks
      • Accounts
      • Transactions
      • Messages
      • Block and Transaction Pagination: Best Practice
      • Multiple Message Processing and Monitoring
      • Subscribe for REMP receipts
  • Reference
    • GraphQL API
      • Quick Start
      • Samples
      • Networks
      • Explore Playground
      • Connect to GraphQL API
      • Schema
      • Blockchain API
      • Info API
      • Query Collections: Query Language
      • Subscribe Collections
      • Message Monitor API
      • Field Descriptions
    • Evercloud API Add-ons
      • Query cost
      • Blockchain Statistics
      • FT (Fungible Token) API
      • Price
      • Counterparties
      • Flex API
    • Changelog
      • Evercloud
      • Dapp Server (DS)
      • Simple Emulator (SE)
    • Breaking changes
      • Policy
      • Deprecation schedule
      • Migration guides
        • GraphQL API 1.0 migration
  • SDK and tools
    • everdev
    • Client Libraries
  • Guides
    • How to connect to GraphQL API
  • 😊Social
    • Feedback page
    • Telegram
    • Discord
Powered by GitBook
On this page
  • About query cost calculation
  • Calculate query cost

Was this helpful?

  1. Reference
  2. Evercloud API Add-ons

Query cost

Use this API to calculate the price of your query

PreviousEvercloud API Add-onsNextBlockchain Statistics

Last updated 1 year ago

Was this helpful?

About query cost calculation

We have implemented static query cost analyses, based on GraphQL schema types and fields.

Total query cost is calculated from summarizing all resolver costs plus all fields costs from those resolver result set. If the field is of an array type, the total cost of the field is multiplied by numerator - limit, after or before parameters of the query. If none is specified, then default value = 50 is used.

Almost all scalar types (i.e. Int, String, bool) have the same cost, but there are exceptions for big strings, as account.boc, block.boc, etc.

You can observe gql schema for types and fields costs:

Calculate query cost

Type any query in the playground, and add cost api call above, so that it will show you the cost of your query. Use tryRun parameter to see the cost, without query execution.


query{
  cost(dryRun:true){
    complexity
    explain
  }
  ft{
    token(address:"0:597081d5dfaf8f9a3bffbc354d5bab4bb200be9b675000b06a631a3301d6ae97"){
      address
      symbol
      name
      decimals
      rootOwner
      totalSupply
      transfers{
        edges{
          node{
            value
            transferType
            timestamp
          }
        }
      }
    }
  }
}

Result:

{
  "data": {
    "cost": {
      "complexity": 311,
      "explain": [
        "Cost (0)",
        "      complexity (0)",
        "      explain -50x- (0)",
        "FungibleTokenQuery (2)",
        "      FungibleToken (2)",
        "            address (1)",
        "            symbol (1)",
        "            name (1)",
        "            decimals (1)",
        "            rootOwner (1)",
        "            totalSupply (1)",
        "            FungibleTokenTransferConnection (1)",
        "                  FungibleTokenTransferEdge -50x- (1)",
        "                        FungibleTokenTransfer (2)",
        "                              value (1)",
        "                              transferType (1)",
        "                              timestamp (1)"
      ]
    }
  }
}