graphprotocol / graph-node

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL
https://thegraph.com
Apache License 2.0
2.92k stars 978 forks source link

Postgres storage requirements of sepolia and base sepolia are high #5355

Open rdx4499 opened 7 months ago

rdx4499 commented 7 months ago

I am not sure if its a bug or not but I have deployed three same subgraph on thee different testnetwork sepolia, base sepolia and pulsechain testnet. I have only done single transaction on both seplia network, for this postgres database size is 17 GB each , and for pulsechain testnet I have done thousands of transaction but it only takes 377 MB. Below is my docker compose file with network configuration

version: "3"
services:
    graph-node-1:
        image: graphprotocol/graph-node
        ports:
            - "8100:8000"
            - "8101:8001"
            - "8120:8020"
            - "8130:8030"
            - "8140:8040"
        depends_on:
            - ipfs-1
            - postgres-1
        extra_hosts:
            - host.docker.internal:host-gateway
        environment:
            postgres_host: postgres-1
            postgres_user: graph-node
            postgres_pass: let-me-in
            postgres_db: graph-node
            ipfs: "ipfs-1:5001"
            ethereum: "mainnet:https://sepolia.infura.io/v3/aeed801be7e042sf87ebaa7965f8b4cc"
            GRAPH_LOG: info
            DISABLE_BLOCK_INGESTOR: "true"
        restart: always

    ipfs-1:
        image: ipfs/kubo:v0.14.0
        ports:
            - "5201:5001"
        volumes:
            - ./data/ipfs-1:/data/ipfs
        environment:
            IPFS_GC_SCHEDULE: "every hour"
        restart: always

    postgres-1:
        image: postgres:14
        ports:
            - "5433:5432"
        command:
            [
                "postgres",
                "-cshared_preload_libraries=pg_stat_statements",
                "-cmax_connections=200",
            ]
        environment:
            POSTGRES_USER: graph-node
            POSTGRES_PASSWORD: let-me-in
            POSTGRES_DB: graph-node
            PGDATA: "/var/lib/postgresql/data"
            POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
        volumes:
            - ./data/postgres-1:/var/lib/postgresql/data
        restart: always

    graph-node-2:
        image: graphprotocol/graph-node
        ports:
            - "8200:8000"
            - "8201:8001"
            - "8220:8020"
            - "8230:8030"
            - "8240:8040"
        depends_on:
            - ipfs-2
            - postgres-2
        extra_hosts:
            - host.docker.internal:host-gateway
        environment:
            postgres_host: postgres-2
            postgres_user: graph-node
            postgres_pass: let-me-in
            postgres_db: graph-node
            ipfs: "ipfs-2:5001"
            ethereum: "mainnet:https://base-sepolia.g.alchemy.com/v2/icYuU5yFEzd9p35GAP2msUDkGXFZWchM"
            GRAPH_LOG: info
            DISABLE_BLOCK_INGESTOR: "true"
        restart: always

    ipfs-2:
        image: ipfs/kubo:v0.14.0
        ports:
            - "5202:5001"
        volumes:
            - ./data/ipfs-2:/data/ipfs
        environment:
            IPFS_GC_SCHEDULE: "every hour"
        restart: always

    postgres-2:
        image: postgres:14
        ports:
            - "5434:5432"
        command:
            [
                "postgres",
                "-cshared_preload_libraries=pg_stat_statements",
                "-cmax_connections=200",
            ]
        environment:
            POSTGRES_USER: graph-node
            POSTGRES_PASSWORD: let-me-in
            POSTGRES_DB: graph-node
            PGDATA: "/var/lib/postgresql/data"
            POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
        volumes:
            - ./data/postgres-2:/var/lib/postgresql/data
        restart: always

    graph-node-3:
        image: graphprotocol/graph-node
        ports:
            - "8300:8000"
            - "8301:8001"
            - "8320:8020"
            - "8330:8030"
            - "8340:8040"
        depends_on:
            - ipfs-3
            - postgres-3
        extra_hosts:
            - host.docker.internal:host-gateway
        environment:
            postgres_host: postgres-3
            postgres_user: graph-node
            postgres_pass: let-me-in
            postgres_db: graph-node
            ipfs: "ipfs-3:5001"
            ethereum: "mainnet:https://rpc.v4.testnet.pulsechain.com"
            GRAPH_LOG: info
            DISABLE_BLOCK_INGESTOR: "true"
        restart: always

    ipfs-3:
        image: ipfs/kubo:v0.14.0
        ports:
            - "5203:5001"
        volumes:
            - ./data/ipfs-3:/data/ipfs
        environment:
            IPFS_GC_SCHEDULE: "every hour"
        restart: always

    postgres-3:
        image: postgres:14
        ports:
            - "5435:5432"
        command:
            [
                "postgres",
                "-cshared_preload_libraries=pg_stat_statements",
                "-cmax_connections=200",
            ]
        environment:
            POSTGRES_USER: graph-node
            POSTGRES_PASSWORD: let-me-in
            POSTGRES_DB: graph-node
            PGDATA: "/var/lib/postgresql/data"
            POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
        volumes:
            - ./data/postgres-3:/var/lib/postgresql/data
        restart: always

How can I reduce the database size ?

github-actions[bot] commented 2 days ago

Looks like this issue has been open for 6 months with no activity. Is it still relevant? If not, please remember to close it.