Загрузка...

most common interview question #tech #systemdesign #backend #gratitude #fyp #shortvideo #ytshorts

Trick questions asked by Interviewers.. here is the explaination
1️⃣Both count rows, not values

COUNT(*) counts every row.

COUNT(1) evaluates the constant 1 for every row.

In both cases, the database still counts rows.

2️⃣The optimizer treats them identically

Query optimizers rewrite COUNT(1) into COUNT(*).

Execution plans are the same.

Reality: No performance difference.

3️⃣No NULL checks in either case

1 is never NULL, so COUNT(1) does not filter anything. Same behavior as COUNT(*).

4️⃣Index and storage access are identical

Both queries scan the same data or index pages. No extra I/O, no extra CPU.

Applies to: MySQL, PostgreSQL, Oracle, SQL Server

5️⃣ The "COUNT(1) is faster" myth is outdated This came from very old database engines.

Modern engines fully optimize both.

👉Final Verdict (INTERVIEW SAFE ANSWER)

Neither is faster

Both compile to the same execution plan
Use COUNT(*) for clarity and intent.

[COUNT star vs COUNT 1, SQL interview questions, database performance myths, SQL optimization explained, backend engineering concepts, MySQL Postgres internal]
Save this for interviews
#techdevelopers #devlife #fullstackdev #codingrules #codingblog #codingsecrets #codingsuccess #dailydev
Share with a frontend or backend dev Follow for system design & full-stack fundamentals

#codinginterview #cleancoder #technicalinterview #codebuild #techinterviews #techinterview #keepcoding #codecareer #codementor #coderush

[software, coder, developer, frontend developer, backend engineering, system design, interview prep, software engineer, computer networks, computer science, cs students, programming, coding, web development, internet basics, tech reels, learn in public, FAANG, google, hiring, interviews, tips]

Видео most common interview question #tech #systemdesign #backend #gratitude #fyp #shortvideo #ytshorts канала TechKiKahani
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять