Category Archives: Без рубрики

SQL.What are domain types (or constraints on data types), and how do they help enforce data correctness?

his is a schema design / data integrity question. Interviewers ask it to see whether you push correctness into the database, not only into application code. Short, interview-ready answer Domain types and constraints restrict what values a column can hold, … Continue reading

Posted in Без рубрики | Comments Off on SQL.What are domain types (or constraints on data types), and how do they help enforce data correctness?

SQL.How does SQL handle comparisons between different data types (for example, string vs number), and why is this dangerous?

This is a semantic + performance trap question. Interviewers ask it to see whether you understand implicit casting, three-valued logic, and index usage. Short, interview-ready answer SQL implicitly casts values to make comparisons possible, but this can change semantics and … Continue reading

Posted in Без рубрики | Comments Off on SQL.How does SQL handle comparisons between different data types (for example, string vs number), and why is this dangerous?

SQL.What is the difference between DATE, TIME, TIMESTAMP, and TIMESTAMPTZ, and which one should be used for business events?

Short, interview-ready answer DATE stores a calendar day, TIME stores a time of day, TIMESTAMP stores a date and time without timezone, and TIMESTAMPTZ stores an absolute moment in time.For business events, TIMESTAMPTZ should almost always be used. 1️⃣ DATE … Continue reading

Posted in Без рубрики | Comments Off on SQL.What is the difference between DATE, TIME, TIMESTAMP, and TIMESTAMPTZ, and which one should be used for business events?

SQL.How do numeric types like INTEGER, BIGINT, DECIMAL, and FLOAT differ in terms of precision and use cases?

Short, interview-ready answer INTEGER and BIGINT are exact whole numbers, DECIMAL is exact for fractional values, and FLOAT is approximate and should never be used for money.The choice affects correctness, not just storage. 1️⃣ INTEGER / BIGINT — exact whole … Continue reading

Posted in Без рубрики | Comments Off on SQL.How do numeric types like INTEGER, BIGINT, DECIMAL, and FLOAT differ in terms of precision and use cases?

SQL.What problems can arise from implicit type casting in SQL, and how can it affect indexes?

Short, interview-ready answer Implicit type casting can change query semantics, hide bugs, and—most importantly—prevent index usage by forcing the database to apply functions to indexed columns, leading to full scans instead of index scans. 1️⃣ What is implicit type casting? … Continue reading

Posted in Без рубрики | Comments Off on SQL.What problems can arise from implicit type casting in SQL, and how can it affect indexes?

SQL.How does NULL differ from 0, an empty string, or FALSE in SQL?

Short, interview-ready answer NULL means “unknown or not applicable”, while 0, empty string (”), and FALSE are known, concrete values.NULL propagates through expressions and comparisons, whereas the others behave like normal values. Core semantic difference NULL Represents absence of a … Continue reading

Posted in Без рубрики | Comments Off on SQL.How does NULL differ from 0, an empty string, or FALSE in SQL?

SQL.What is the difference between CHAR, VARCHAR, and TEXT, and when would you choose each?

Short answer (what to say first) CHAR is fixed-length and space-padded, VARCHAR is variable-length with a limit, and TEXT is variable-length without a defined limit.In practice, VARCHAR is the default choice, CHAR is for truly fixed-size values, and TEXT is … Continue reading

Posted in Без рубрики | Comments Off on SQL.What is the difference between CHAR, VARCHAR, and TEXT, and when would you choose each?

SQL.What is MVCC ?

MVCC is a concurrency control mechanism where the database keeps multiple versions of a row, allowing readers and writers to proceed without blocking each other. Why MVCC exists (one line) To avoid read locks blocking writes (and vice versa) while … Continue reading

Posted in Без рубрики | Comments Off on SQL.What is MVCC ?

SQL.What is AutoVacuum Postgres ?

Autovacuum is PostgreSQL’s background process that cleans up dead tuples created by MVCC and refreshes statistics, so tables don’t bloat and the optimizer stays accurate. Why it exists (one line) Postgres uses MVCC, so updates/deletes create dead rows; autovacuum removes … Continue reading

Posted in Без рубрики | Comments Off on SQL.What is AutoVacuum Postgres ?

SQL.What is eventual consistency ?

Eventual consistency means that if no new updates are made, all replicas will eventually converge to the same state, but reads may temporarily see stale data. Key phrase to remember: Consistency is delayed, not lost. Why eventual consistency exists Strong … Continue reading

Posted in Без рубрики | Comments Off on SQL.What is eventual consistency ?