redline
MediumPerformanceselect-star

Reads whole rows

Reads whole rows. Loads every column (SELECT * FROM). If the code reads a couple of fields, select just those.

This is how the comment reads inline, under the flagged line.

Why it matters

Whole-row reads move columns nobody uses, defeat covering indexes, and pull large JSON or text columns off disk on every call. They get slower as the table grows.

What to do

Select the columns you read: select id, status from orders.

Examples

Flagged
db.query("SELECT * FROM orders WHERE user_id = $1", [id]);
Better
db.query("SELECT id, status FROM orders WHERE user_id = $1", [id]);

What it catches

It reads a pattern on each line, aware of strings and comments. Languages: Any file. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.

Flagged

db.query("SELECT * FROM users");
await sb.from("t").select("*");
const rows = await db.select().from(users);

Left alone

db.query("SELECT id FROM users");
const s = "select * of them";

Research

`SELECT *` and ORM reads of whole rows. It moves and parses columns nobody reads, and it can leak new sensitive columns.

Turn it off or change it

In a config file for the CLI, or in the API's rules field:

{
  "rules": {
    "disable": [
      "select-star"
    ],
    "severity": {
      "select-star": "low"
    }
  }
}

Read the source or report a false positive.