Skip to the content.

Latency simply means the time delay between an action and the response to that action.

In computing and networking, it refers to the time it takes for data to travel from one point to another — like from your computer to a server and back. It’s usually measured in milliseconds (ms).


Simple real-life analogy

If you:


In networking:

If you send a request (like clicking a link on a website):


In databases:

If you run a query:


Types of latency

Type Example
Network latency Delay between your computer and a remote server
Disk latency Delay in reading/writing to a hard drive or SSD
Application latency Delay caused by code execution or database processing
Input latency Delay between pressing a key and seeing it appear on screen (like in gaming)

Low latency = Good

(Fast response time — e.g., 20ms)

High latency = Bad

(Slow response time — e.g., 300ms or more → noticeable lag)


Quick example:


Query Latency

👉 The total time between sending the query and getting the first response back.

It includes all delays:

Focus: How long you (the client) wait to start seeing a response.


Query Execution Time

👉 The time the database engine spends actually processing (executing) the query on the server.

It includes:

Focus: How long the server spends working to produce the result (ignores network delays).


In short:

Term What it measures Includes network delay?
Query Latency Time from sending query to receiving first result Yes
Query Execution Time Time the database server takes to process the query No

Quick analogy (Restaurant example 🍽️)

The total time you waited = Query Latency The time chef spent cooking = Query Execution Time


✅ Summary:

Query Latency = Query execution time + network delay (round-trip) + any other delays.


If you’re running queries on the same machine (local DB), network delay is negligible — so latency ≈ execution time. But in real-world distributed systems or cloud apps, they can be quite different.


🚀 Latency vs Bandwidth — Clear Definitions

Term Meaning Unit Key Point
Latency Time delay for data to travel from source to destination Milliseconds (ms) How long it takes for 1 bit to go from A → B
Bandwidth Amount of data that can be transferred per second Megabits per second (Mbps) (or GB/s etc.) How much data you can send per second

Simple analogy — Road example 🛣️


✅ Quick facts to remember

Term High is good or bad? Key goal
Latency Lower = Better (less delay) Fast response time
Bandwidth Higher = Better (more data at once) More throughput

📱 Real-world example

→ Even though the pipe is wide (lots of data can go), every request/response takes time to start flowing → Laggy experience (bad for gaming, video calls)


✨ Super short takeaway