2 ms·
What if you need all columns of a few rows, but the rows chosen as the ones satisfying some condition on a few columns across all the rows? Maybe you could sel
by OJFord 4y ago
What if you need all columns of a few rows, but the rows chosen as the ones satisfying some condition on a few columns across all the rows?
Maybe you could select pk,a,b,c; identify the ones you want in Python; select * where pk in those; and finish doing whatever in Python - but now you've got two round trips to the database.
Obviously that probably doesn't matter if you're doing some 'offline' analytics, but if you're serving a request in a web app it's going to be a lot slower than if you can push that logic into the db, and make a single query.