Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate index names #282

Open
hokaxbt opened this issue Dec 27, 2024 · 1 comment
Open

duplicate index names #282

hokaxbt opened this issue Dec 27, 2024 · 1 comment

Comments

@hokaxbt
Copy link

hokaxbt commented Dec 27, 2024

Shovel version af07 introduces tableindex field, which enhances query performance.

However, there's a limitation in the current implementation where specifying only column names as parameters can cause silent index creation failures.

For example, when defining two tables with similar index configurations:

{
    "name": "eth_events_univ2_pair_created",
    "columns": [
        { "name": "block_num", "type": "numeric" },
        { "name": "transaction_hash", "type": "bytea" },
        // ... other columns
    ],
    "index": [
        ["block_num DESC"],
        ["transaction_hash"],
        // ... other indexes
    ]
}

{
    "name": "eth_events_univ2_mint",
    "columns": [
        { "name": "block_num", "type": "numeric" },
        { "name": "transaction_hash", "type": "bytea" },
        // ... other columns
    ],
    "index": [
        ["block_num DESC"],
        ["transaction_hash"],
        ["pair"]
    ]
}

Shovel attempts to create indexes with identical names (shovel_block_num and shovel_transaction_hash) across both tables, resulting in index creation failures in one of the table

@ryandotsmith
Copy link
Member

Thanks for reporting. This is tricky to fix because shovel would need to take into account a new index naming scheme to avoid creating duplicate indexes with different names.

Not sure when I will fix this.

In the meantime you can create indexes manually.

@ryandotsmith ryandotsmith changed the title bug(shovel): Index name collision duplicate index names Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants