Multiple choice technology databases

Why one should not use “select * from table;” Choose all that apply

  1. Avoid full table scan

  2. Avoid index scan

  3. Avoid network traffic

  4. Avoid cartesian join

Reveal answer Fill a bubble to check yourself
A,C Correct answer
Explanation

SELECT * should be avoided because: 1) it can cause unnecessary full table scans when only specific columns are needed (option A), and 2) it retrieves all columns, increasing network traffic between database and application (option C). Using SELECT * doesn't inherently cause index scans (actually often prevents them) or cartesian joins.

AI explanation

'SELECT * FROM table' should be avoided mainly to avoid unnecessary network traffic and to avoid forcing a full table scan. Selecting all columns often pulls far more data across the network than the application actually needs (especially with wide tables, BLOBs, or many columns), wasting bandwidth and memory — hence 'avoid network traffic'. It also frequently prevents the optimizer from using a covering index (an index containing only the needed columns), forcing it to fall back to scanning the full table to fetch unselected columns — hence 'avoid full table scan'. The other two options are backwards: SELECT * doesn't inherently cause an index scan to be avoided (irrelevant framing), and it has no direct bearing on Cartesian joins, which result from missing join conditions, not column selection.