gluesql / gluesql

GlueSQL is quite sticky. It attaches to anywhere.

Home Page:https://gluesql.org/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Index::create_index is not supported (IndexedDb)

gitmalong opened this issue · comments

pub async fn create_index(glue: &mut Glue<IdbStorage>) {
        glue.execute(format!("CREATE INDEX idx_year ON {TABLE_SETTINGS} (year);")).await.unwrap();
}

Do I understand correctly that the IndexedDb storage does not support indexes? Do I have to expect slow queries when filtering a huge amount of data?

Is there a overview that shows the supported features of each storage gluesql offers?

Do I understand correctly that the IndexedDb storage does not support indexes? Do I have to expect slow queries when filtering a huge amount of data?

currently sled storage is the only storage that support non-clustered index.
though it might not be sufficient, you can still use clustered index (primary key) in IndexedDB storage.

Is there a overview that shows the supported features of each storage gluesql offers?

Currently we don't have a page for this. but this would be really nice to have the overview section for supported features.

though it might not be sufficient, you can still use clustered index (primary key) in IndexedDB storage.

Does these index values have to be unique within a table?

    table(TABLE_SETTINGS)
        .create_table_if_not_exists()
        .add_column("year INTEGER PRIMARY KEY")
        .add_column("arbitrary TEXT")
        .execute(glue)
        .await
        .unwrap();

In other words, can I add multiple entries with the same year?

yes at least PRIMARY KEY supports unique + not null index.

In other words, can I add multiple entries with the same year?

No, only a single record can be stored because PRIMARY KEY constraint implies UNIQUE + NOT NULL