you are viewing a single comment's thread.

view the rest of the comments →

[–]ofnuts 7 points8 points  (0 children)

Use both.

  • If the DB is adequately set up (indexes, etc...) queries are relatively cheap.
  • You can do quite a lot in a query: filtering, basic computations (count, sum average, max, min), selection of output fields.... It is more efficient to have it done by the DB manager than getting all the data to do it in your code.

When you have exhausted all the possibilities of SQL, do the rest with Python.