Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Kjetil-Lennart A. Lorentzen
Kjetil-Lennart A. Lorentzen
13,390 Points

Where should we do calculations?

I would say this question is about scaling, i am taking the SQL course and we are learning to do calculations in the queries. should calulations be done on the server-side or client-side? If the project is gigantic, and it has millions of users, would it then make senese that calculating tax etc be done on client-side to relieve the server-side of stress?

1 Answer

Steven Parker
Steven Parker
231,271 Points

If calculations are different for each user, it would certainly make sense to do them on the user side, but the development would be a bit more complex. You'd need to transmit script code along with the data to the client to make it work.

Having everything in one place would make development and maintenance simpler. You'd also want to consider if the result of the calculations are needed by the page layout processes in the server.