Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
is_excluded = 1 is very different from do_not_touch != 1. Whenever possible, try to structure your data and queries so that you can do an equi-join - that is, compare things using an = comparison. ...
Answer
#1: Initial revision
`is_excluded = 1` is very different from `do_not_touch != 1`. Whenever possible, try to structure your data and queries so that you can do an equi-join - that is, compare things using an `=` comparison. `>` and `<` and `!=` can be really bad because the database will at the very least have to do an index scan, if there's an appropriate index available - if not, full table scan, baby! Wooo! If you can use `do_not_touch = 0` that would be nice, but I obviously have no idea what that field contains. Also, it helps to have an appropriate index. For your second query UPDATE example_table SET textfield = 'X' WHERE textfield = 'Y' and do_not_touch != 1 it would seem that an index on `example_table(textfield, do_not_touch)` would perhaps be helpful.