Interview questions

MSSQL IS NULL Interview Performance: The 30-Second Answer

August 13, 2025Updated May 15, 202619 min read
What No One Tells You About Mssql Is Null And Interview Performance

Master MSSQL IS NULL interview performance with a 30-second answer: keep columns bare, avoid broken SARGability, and explain seeks vs scans.

The question lands without warning: "Is IS NULL slow in SQL Server?" The room waits. Most candidates either freeze or overcorrect into a five-minute lecture about query optimizers. Neither lands well. Nailing mssql is null interview performance means knowing the 30-second version — the one that's technically correct, sounds confident, and leaves room for a smart follow-up. That's what this guide gives you.

The short answer is that IS NULL itself is rarely the problem. The problem is what you do around it. Wrap a column in a function inside a WHERE clause and you've broken SARGability — the engine can no longer seek into the index efficiently, and a scan follows. Keep the column bare and the predicate simple, and SQL Server can handle NULL filtering with an index seek just like any other equality check.

Everything below builds out that answer with the mechanics, the execution plan evidence, and the exact wording to use when the interviewer pushes back.

The 30-Second Answer You Should Actually Say

Say the simple thing first, then earn the nuance

The instinct in a technical interview is to hedge immediately — "well, it depends on the index, the distribution, the statistics..." — and that instinct is wrong. It signals uncertainty, not depth. The correct move is to open with the clean claim and then demonstrate you know where it breaks down.

For mssql is null interview performance, the clean claim is: IS NULL is usually fine. The real trap is wrapping the column in a function.

Once you've said that, you've already separated yourself from candidates who either dismiss the question ("IS NULL is just a predicate, it's fast") or panic into vagueness. Now you can earn the nuance by naming SARGability specifically — and the interviewer knows you've actually thought about execution plans, not just syntax.

What this looks like in practice

Here is the answer block you should be able to say out loud in under 30 seconds:

"IS NULL itself doesn't usually cause a performance problem in SQL Server — the optimizer can seek on a nullable indexed column just fine when the predicate stays bare. The issue comes up when people write something like `WHERE ISNULL(Col, 0) = 0` instead of `WHERE Col IS NULL`. That wraps the column in a function, which breaks SARGability and can force a scan instead of a seek. In practice, I'd always check the execution plan to confirm, but the rule of thumb is: keep the column bare in the WHERE clause."

That answer is accurate, specific, and scalable — a junior can say it, a mid-level can add the filtered index follow-up, and a DBA can extend it into cardinality estimation. The Microsoft documentation on search arguments confirms that function-wrapped predicates prevent the optimizer from matching the predicate to an index range scan, which is the structural reason behind this rule.

IS NULL in SQL Server Is Not the Problem You Think It Is

The part people confuse: semantics versus access path

NULL filtering is a logical operation first. The engine evaluates `Col IS NULL` as a three-valued logic check — true, false, or unknown — before it thinks about how to retrieve rows. The performance question is separate: can the engine satisfy this predicate by searching an index, or does it have to read every row and evaluate the condition inline?

Most candidates conflate these two things. They hear "NULL" and think "special case" and assume something slow must be happening. In reality, IS NULL in SQL Server is handled well by the optimizer when the predicate is left alone. The access path — seek versus scan — depends on whether the predicate is SARGable, not on whether it involves NULL.

What this looks like in practice

Consider a `WorkOrders` table with 2 million rows and a nullable `CompletedDate` column with a nonclustered index on it. About 15% of rows have `CompletedDate IS NULL` — unfinished orders.

Query A performs an index seek with roughly 340 logical reads on a standard test setup. Query B performs an index scan — or in some configurations a full table scan — with logical reads climbing past 8,000 on the same data. The column is identical. The index is identical. The only difference is whether the optimizer can match the predicate to the index's sorted structure.

That's the distinction the interviewer wants to hear: semantics (what you're asking for) versus access path (how the engine retrieves it). NULL handling in SQL Server is well-documented in Microsoft's indexing architecture guide, which confirms that nullable columns are fully indexable and that index entries for NULL values exist in the B-tree structure.

Why WHERE Col IS NULL Can Still Use an Index Seek

The engine can search for NULL just fine when the predicate stays simple

SARGability in SQL Server means the predicate can be matched to an index range. The term comes from "Search ARGument able" — a predicate is SARGable when the optimizer can translate it into a start and end key for an index seek. `Col IS NULL` qualifies because the optimizer knows exactly which B-tree entries represent NULL and can seek directly to them.

This surprises people because NULL feels like an absence — how do you index something that isn't there? SQL Server answers this by storing NULL values in the index leaf pages just like any other value. The index is sorted, NULL entries are grouped together, and the optimizer can seek to that range efficiently. The predicate stays bare, the column stays unmodified, and the seek works.

What this looks like in practice

Running `WHERE CompletedDate IS NULL` on the indexed nullable column from the example above produces an execution plan with a Nonclustered Index Seek operator, not a scan. The actual execution plan in SQL Server Management Studio shows the seek predicate listed as `CompletedDate IS NULL` — the optimizer has translated the predicate directly into an index range operation. Logical reads: roughly 340 for 2 million rows with 15% NULL distribution. That's the seek working.

The key numbers to remember for an interview: a seek on 300,000 matching rows out of 2 million produces logical reads in the low hundreds. A scan on the same table produces logical reads in the thousands. The difference is not marginal — it's the difference between a query that runs in milliseconds and one that competes for I/O budget.

When the stats matter more than the syntax

Even a technically SARGable predicate can produce a scan if the optimizer's statistics are misleading. If the NULL distribution in the statistics histogram is stale — say, the table was loaded with 80% NULLs six months ago and is now 2% NULL — the optimizer may estimate a large number of matching rows and choose a scan because it thinks a seek would be inefficient.

This is the follow-up most interviewers are hoping you'll volunteer: "The predicate is SARGable, but cardinality estimation can still push the optimizer toward a scan if the statistics are out of date." Saying this shows you understand that execution plans are probabilistic decisions, not deterministic rules. Itzik Ben-Gan's work on T-SQL fundamentals covers this cardinality estimation behavior in detail and is worth reading before any SQL Server performance interview.

Why ISNULL(Col,0)=0 Can Block SARGability

The function is the problem, not the intent

The instinct behind `ISNULL(Col, 0) = 0` is reasonable: normalize the NULL to a default value so the comparison is clean. In a SELECT list, this is harmless. In a WHERE clause, it changes the shape of the predicate in a way the optimizer cannot recover from.

When a function wraps a column, the optimizer can no longer determine what range of index values satisfies the predicate without evaluating the function for every row. The index is built on `Col`, not on `ISNULL(Col, 0)`. The optimizer has no index to seek into for the transformed expression, so it falls back to scanning the base data and applying the function row by row.

What this looks like in practice

Using the same `WorkOrders` table with the nonclustered index on `CompletedDate`:

The execution plan for this query shows an Index Scan — not a seek. The seek predicate is gone. The optimizer reads every leaf page of the index and evaluates the ISNULL expression inline. Logical reads jump from ~340 to over 8,000 on the same data set. The index exists, it's maintained, it costs write overhead — and it's completely bypassed.

The important catch: ISNULL(field,0)=0 is not the same test

This is the hidden semantic bug that experienced interviewers specifically watch for. `ISNULL(CompletedDate, '1900-01-01') = '1900-01-01'` matches two completely different populations: rows where `CompletedDate IS NULL` and rows where `CompletedDate = '1900-01-01'`. If your data has any sentinel values — and legacy systems almost always do — this predicate silently includes rows that were never intended to match.

The ISNULL vs COALESCE discussion matters here too: both expressions in a WHERE clause have the same SARGability problem, but COALESCE is defined by the SQL standard and evaluates its arguments differently under some type-conversion scenarios. The semantic bug, though, is the same regardless of which function you use. Always ask: am I testing for absence of data, or am I normalizing a value? Those are different questions and they deserve different predicates.

ISNULL, COALESCE, and CASE Are Not Interchangeable

They solve the same business problem in different ways

ISNULL is SQL Server-specific. It takes exactly two arguments and returns the first non-NULL one. COALESCE follows the ANSI SQL standard, accepts multiple arguments, and returns the first non-NULL from the list. CASE gives you explicit conditional logic and is the most readable when the business rule is complex. All three can replace NULL with a default — but they behave differently in ways that matter in an interview.

The ISNULL vs COALESCE distinction most interviewers care about is return type. ISNULL returns the data type of its first argument. COALESCE returns the data type of the highest-precedence argument in the list. This matters when the replacement value has a different type than the column.

What this looks like in practice

In the SELECT list, the performance difference between the three is negligible — you're changing output values, not search paths. In the WHERE clause, all three function-wrapped versions break SARGability the same way.

The hidden interview trap is data type behavior

Consider a nullable `varchar(10)` column where you use `ISNULL(Col, 'N/A')`. The return type is `varchar(10)` — the replacement string gets silently truncated if it's longer than the column definition. With `COALESCE(Col, 'N/A')`, the return type follows the highest-precedence argument, which may differ. Microsoft's documentation on ISNULL vs COALESCE explicitly calls out this return-type difference and is the canonical reference for this answer. Knowing this distinction — and citing it as a type-conversion edge case rather than a performance issue — is exactly the kind of specificity that impresses interviewers.

When ISNULL Has Little or No Performance Cost

SELECT lists are usually the safe place for it

NULL filtering performance concerns are almost entirely about the WHERE clause. When ISNULL appears in a SELECT list, it operates on rows that have already been retrieved — the access path is already decided. Replacing a NULL with a display value in a projection changes the output, not the search. That's a scalar operation on a row already in memory, and the cost is trivial.

This is the boundary the reader needs to internalize: predicate position determines whether ISNULL matters for performance. In the SELECT list, it's a formatting concern. In the WHERE clause, it's a structural concern.

What this looks like in practice

A reporting query that pulls open work orders for a dashboard might look like this:

The WHERE clause stays bare — `CompletedDate IS NULL` — so the index seek fires. The SELECT list uses ISNULL twice for display purposes. Logical reads stay in the low hundreds. Duration stays under 10ms. This pattern is common in production reporting layers and carries no meaningful overhead from the ISNULL calls. The seek is doing the heavy lifting; the ISNULL is just formatting the result.

Use Filtered Indexes or Computed Columns When NULL Checks Are Constant

The clean fix is to index the question you keep asking

If the same nullable column is queried with `IS NULL` dozens of times a day, the right answer isn't to keep relying on the full index to seek into a small subset. A filtered index on `IS NULL` is a purpose-built index for exactly that predicate — smaller, faster, and maintained only for the rows that match.

This index contains only the rows where `CompletedDate IS NULL`. A query with `WHERE CompletedDate IS NULL` that matches this filtered index will produce an index seek with dramatically fewer pages to read than the full-column index, because the index itself only contains the relevant rows. The SQL Server execution plan will show the filtered index being used when the query's WHERE clause matches the filter predicate exactly.

What this looks like in practice

For the `ISNULL(Col, 0) = 0` problem — where the business logic genuinely needs to treat NULL and zero as equivalent — a persisted computed column restores indexability:

Now rewrite the query to use the computed column directly:

The optimizer can seek into the index on `DiscountNormalized` because the column is pre-computed and stored — the function is no longer evaluated at query time. The access path is restored. Microsoft's documentation on filtered indexes and computed columns covers both approaches with the exact syntax and limitations.

Choose the workaround that matches the workload

Filtered indexes are the right choice when the predicate is simple (`IS NULL` or `IS NOT NULL`) and the query runs frequently. Computed columns are better when the normalization logic is complex or when multiple queries need to filter on the same derived value. Neither is worth the maintenance cost — write amplification, index fragmentation, schema complexity — if the query runs once a week on a small table. The honest interview answer includes this caveat: "I'd reach for a filtered index for high-frequency NULL checks, but I'd weigh the write overhead against the read gain before adding it to production."

The Interview Wording That Sounds Experienced

Say what is true, not what sounds dramatic

The temptation is to overclaim in both directions — either "IS NULL is always slow" (wrong) or "IS NULL is always fast, don't worry about it" (also wrong). Neither answer survives a follow-up. The wording that sounds experienced acknowledges what's usually true, names the real risk, and defers to the execution plan for the final verdict.

NULL filtering performance is not a dramatic problem. It's a precision problem — the kind where the right answer depends on predicate position, index definition, and data distribution. Saying that clearly is more impressive than a confident wrong answer.

What this looks like in practice

For a junior data analyst or entry-level SQL developer interview:

"IS NULL itself is usually fine in SQL Server — the optimizer can seek on a nullable indexed column when the predicate stays bare. The issue is wrapping the column in a function like ISNULL inside the WHERE clause, which breaks SARGability and can force a scan. I'd check the execution plan to confirm, but the rule of thumb is to keep the column unmodified in the filter."

For a backend developer or DBA interview:

"IS NULL doesn't break SARGability on its own — the optimizer stores NULL values in the index and can seek to them directly. The problem is function-wrapped predicates like ISNULL(Col, 0) = 0, which prevent the optimizer from matching the predicate to an index range. For columns that are filtered on IS NULL constantly, a filtered index is usually the right fix — it's a smaller, purpose-built index for exactly that subset of rows. I'd validate any of this with the actual execution plan and logical read counts before committing to a schema change."

Both answers are grounded, specific, and honest. Neither overclaims. Both leave the interviewer with the impression that you've actually looked at execution plans — not just read about them.

FAQ

Q: Is IS NULL itself slow in MSSQL, or is the problem really wrapping a column in a function?

IS NULL itself is not the problem. SQL Server stores NULL values in nonclustered index leaf pages and can seek to them efficiently when the predicate is bare. The performance issue arises when a function like ISNULL or COALESCE wraps the column inside a WHERE clause, which prevents the optimizer from matching the predicate to an index range and typically forces a scan instead.

Q: Why does WHERE field IS NULL usually allow an index seek while WHERE ISNULL(field,0)=0 may not?

`WHERE field IS NULL` leaves the column unmodified, so the optimizer can translate the predicate directly into an index range seek — it knows exactly which B-tree entries represent NULL. `WHERE ISNULL(field, 0) = 0` wraps the column in a function, and the index is built on `field`, not on the transformed expression. The optimizer cannot determine which index entries satisfy the function without evaluating it for every row, so it scans instead of seeking.

Q: What is the difference between IS NULL, ISNULL(), COALESCE(), and CASE in SQL Server?

IS NULL is a predicate — it tests whether a value is NULL and returns true or false. ISNULL() is a SQL Server-specific scalar function that replaces NULL with a specified default and returns the data type of its first argument. COALESCE() is the ANSI standard equivalent that accepts multiple arguments and returns the data type of the highest-precedence argument. CASE is an explicit conditional expression that gives the most readable control over NULL replacement logic. In a WHERE clause, all three function-based options break SARGability the same way.

Q: When does ISNULL have little or no performance impact?

ISNULL in a SELECT list is almost always cheap because it operates on rows already retrieved — it changes output values, not the access path. The performance concern is specific to ISNULL appearing in a WHERE clause, where it wraps the column and prevents an index seek. The practical rule: SELECT list is safe, WHERE clause requires care.

Q: How should I explain NULL filtering performance in an interview without overclaiming?

Lead with the clean claim — IS NULL is usually fine — then name the real risk: function-wrapped predicates breaking SARGability. End by saying you'd verify with the execution plan. This structure shows you understand the principle, know where it breaks down, and don't make absolute claims you can't defend. Avoid saying IS NULL is "always fast" or "always slow" — both are wrong and a good interviewer will push back immediately.

Q: What query rewrites preserve performance when filtering for NULL or default values?

Keep the column bare in the WHERE clause: use `WHERE Col IS NULL` instead of `WHERE ISNULL(Col, default) = default`. If you genuinely need to treat NULL and a sentinel value as equivalent, create a persisted computed column that applies the normalization at write time, then index and query the computed column directly. This restores SARGability without changing the query's business logic.

Q: Should I use a computed column or a filtered index for frequent NULL checks?

Use a filtered index when the predicate is simple — `IS NULL` or `IS NOT NULL` — and the query runs frequently. The filtered index is smaller than the full column index and the seek is faster because fewer pages need to be read. Use a persisted computed column when the normalization logic is more complex or when multiple queries need to filter on the same derived value. If the query is rare or the table is small, neither fix is worth the write overhead and schema complexity.

How Verve AI Can Help You Prepare for Your Interview With MSSQL IS NULL Performance

The structural problem with SQL performance interviews isn't knowing the facts — it's being able to reconstruct the reasoning live, under pressure, when the follow-up question goes somewhere you didn't script. You can memorize that IS NULL is SARGable and ISNULL in a WHERE clause isn't, but the moment the interviewer asks "what would you actually check in the execution plan?" the answer needs to come from understanding, not recall.

Verve AI Interview Copilot is built for exactly that gap. It listens in real-time to the live interview conversation and responds to what's actually being asked — not a canned prompt, but the specific follow-up the interviewer just said. If you answer the IS NULL question cleanly and the interviewer pivots to filtered indexes or cardinality estimation, Verve AI Interview Copilot surfaces the relevant context immediately, so you can extend your answer rather than stall. The tool stays invisible while it does this — it doesn't disrupt the conversation, it runs alongside it. For SQL performance topics where the first answer is straightforward but the follow-ups require depth, having something that responds to what you actually said is the difference between a good answer and a great one. Verve AI Interview Copilot is the structural fix for the part of interview prep that flash cards can't reach.

The interview answer for MSSQL IS NULL performance is short: IS NULL is usually fine, the real trap is function-wrapped predicates breaking SARGability, and the execution plan is the final arbiter. Memorize that sentence. Then memorize the one follow-up: for high-frequency NULL checks, a filtered index is the clean fix. Those two pieces cover 90% of what a SQL Server interview will throw at you on this topic — and they hold up under pressure because they're grounded in how the optimizer actually works, not in folklore about NULL being slow.

JM

James Miller

Career Coach

Ace your live interviews with AI support!

Get Started For Free

Available on Mac, Windows and iPhone