First steps with GWT - 003

In most of the WEB (in our case GWT) applications we need to access the server to get the information from databases. So, in GWT we are using the standard GWT-RPC which resolves the automatic serialization of the parameters and results from/to server.

Problem: During any application we may need multiple parts of information from server that can be implemented by different RPCs. Question is how to achieve this: by having multiple RPC calls to the server, where the data is small and retrieved quickly (the first impression), or to make a new super-RPC that will retrieve all data and does one single call to the server ?

Preambul: the serialization of the data thru RPC is quite fast, if we activate the compression in the RPC-servlet we can make it even faster.

Solution: after lots of tests we can recommend that the "second" solution is better (one call to transfer more data at once).

Problem: "SELECT *" or "SELECT col1, col2" ?

This recommendation is not related with GWT, but with the database access in general. It's faster to write the SELECT statements more precisely, which means instead of writing the generic SELECTs like this

SELECT * FROM table

where we are using only a subset of column, it's better to write this one:

SELECT col1, col2 FROM table

because the only col1,col2 will be retrieved from the database, not the rest of unused columns and in case of big tables, with many columns, this is a major improvement.

No comments:

Post a Comment