menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Databases

>

Avoid SELE...
source image

Dev

3w

read

438

img
dot

Image Credit: Dev

Avoid SELECT *, even on a single-column tables

  • Using SELECT * means that the database optimizer cannot choose index-only scans.
  • The computational overhead of deserialization can slow down query performance.
  • Not all columns are stored inline, and retrieving large columns like blobs increases I/Os.
  • Before the query result is sent to the client, it is serialized according to the communication protocol supported by the database, which affects network latency.
  • Client apps must deserialize the data after they receive the raw bytes, adding to overall processing time.
  • Using SELECT * on the client side, even if the table has one or two fields, can introduce unpredictability.
  • Explicit SELECT makes it easier to grep the codebase for in-use columns and make database schema changes.
  • It’s generally best to only select necessary fields to reduce unnecessary overhead when querying tables.
  • However, for tables with few columns and simple data types, SELECT * overhead may be negligible.
  • Be selective about the columns retrieved in queries to improve overall query performance.

Read Full Article

like

26 Likes

For uninterrupted reading, download the app