massalabs / transfers-indexer

Simple transfers of EOA indexer
1 stars 0 forks source link

Optim update? #16

Open sydhds opened 4 months ago

sydhds commented 4 months ago

Find some code like:

 Some(format!(
                            "INSERT INTO transfers (slot, slot_timestamp, from_addr, to_addr, block_id, fee, succeed, amount, effective_amount_received, context, operation_id) VALUES {};",
                            values.join(",")
))

but could use something like:

    let user = ("Alice", "alice@example.com");

    conn.exec_drop(
        r"INSERT INTO users (username, email) VALUES (?, ?)",
        (&user.0, &user.1)
    ).expect("Failed to insert data");

    println!("Data inserted successfully!");

The last one should be a BinQuery instead of a TextQuery ?

AurelienFT commented 4 months ago

Personally, I don't know much about SQL, so if you think it' smore optimize and we see that it's indeed the case lets go.

sydhds commented 4 months ago

Personally, I don't know much about SQL, so if you think it' smore optimize and we see that it's indeed the case lets go.

Will need to try and benchmark it before modifying the code.