0

First of all, a question:

UPDATE table_a 
 SET column_d = 100, column_e = 200 
 WHERE column_a = 1 and column_b = 0 and column_c = 1;
UPDATE table_a 
 SET column_d = 123, column_e = 150 
 WHERE column_a = 2 and column_b = 1 and column_c = 3
...

Imagine this goes on.

Would any performance improvement come from merging these in a single query?

If so, how can it be done?

Remember I am asking specifically for SQLlite3

Akina
20.8k2 gold badges20 silver badges22 bronze badges
asked Nov 5, 2020 at 17:25
0

1 Answer 1

2

Finding each row to update requires an index lookup. Writing a combined query would not change this.

Minimize the transaction overhead by running all UPDATEs inside a single transaction. Further performance improvements are not possible.

answered Nov 6, 2020 at 12:27
1
  • Got it, thanks! That was my initial thought. Already following the advice and moving everything to a single transaction Commented Nov 6, 2020 at 16:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.