Strategies for reducing number of queries to a DB

I suspect the reason you can’t just do

function main()
  data = querythedata()
  metric1(data)
  metric2(data)
end

is because you are trying to have this data to be predefined in the module somehow ??
the other way to do this would be to have the DB query return a dataframe. then you can easily pass the dataframe around and do all sorts of interesting calculations on it in a “DB style”.

2 Likes