Summary from

  • Understanding Prometheus Range Vectors
  • The Anatomy of a PromQL Query

  • What’s a Vector?
    • Since Prometheus is a timeseries database, all data is in the context of some timestamp. The series that maps a timestamp to recorded data is called a timeseries
    • a set of related timeseries is called a vector
    • Ex.
      • http_requests_total is a vector representing the total number of http requests received by a service
      • http_requests_total{code="200"} http_requests_total refers to the entire set of timeseries that are named that. And by appending a {code="200"}, we’re selecting a subset.
  • Types of Vectors
    • Instant vector - a set of timeseries where every timestamp maps to a single data point at that “instant”
      • Imagine evaluating the expression http_requests_total at a given timestamp. http_requests_total is an instant vector selector that selects the latest sample for any time series with the metric name http_requests_total. More specifically, "latest" means "at most 5 minutes old and not stale", relative to the evaluation timestamp. So this selector will only yield a result for series that have a sample at most 5 minutes prior to the evaluation timestamp, and where the last sample before the evaluation timestamp is not a stale marker (an explicit way of marking a series as terminating at a certain time in the Prometheus TSDB).
    • Range vector - a set of timeseries where every timestamp maps to a “range” of data points, recorded some duration into the past.
      • Range vector is mostly used for graphs, where you want to show a PromQL expression over a given time range. A range query works exactly like many completely independent instant queries that are evaluated at subsequent time steps over a given range of time. Of course, this is highly optimized under the hood and Prometheus doesn't actually run many independent instant queries in this case.
  • Differences
    • Instant vectors can be charted; Range vectors cannot. This is because charting something involves displaying a data point on the y-axis for every timestamp on the x-axis. Instant vectors have a single value for every timestamp, while range vectors have many of them. For the purpose of charting a metric, it is undefined1 how to show multiple data points for a single timestamp in a timeseries.
    • Instant vectors can be compared and have arithmetic performed on them; Range vectors cannot. This is also due to the way comparison and arithmetic operators are defined. For every timestamp, if we have multiple values, we don’t know how to add1 or compare them to another timeseries of a similar nature.
    • Range Vectors for counters. We take the instant vector and append our duration [15m]. This part is called the range selector and it transforms the instant vector into a range vector. We then use a function like increase which effectively subtracts the data point at the start of the range from the one at the end. increase(http_requests_total{code="200",handler="/api/v1/query"}[15m]) represent it is the increase in the total number of requests over the past fifteen minutes
Answer from zangw on Stack Overflow
🌐
SigNoz
signoz.io › guides › what is the difference between prometheus vectors - instant vs range explained
What is the Difference Between Prometheus Vectors - Instant vs Range Explained | SigNoz
October 14, 2024 - This article delves into the ... in your monitoring setup. Prometheus vectors form the backbone of time series data representation in modern monitoring systems....
🌐
Promlabs
training.promlabs.com › training › monitoring-and-debugging-prometheus › metrics-based-meta-monitoring › end-to-end-watchdog-alerts
Monitoring and Debugging Prometheus | Prometheus Trainings by PromLabs
Configuring an alerting rule that is always firing, e.g. using the PromQL expression vector(1), or simply 1 (the numeric value doesn't matter) to always produce a single output time series.
🌐
Medium
tiborpetroczy.medium.com › mastering-prometheus-from-fundamentals-to-exam-ready-with-hands-on-labs-a6eb37f46631
Mastering Prometheus: From Fundamentals to Exam-Ready with Hands-On Labs | by Tibor Petróczy | Medium
August 16, 2025 - GotifyTestAlert: A test alert that always fires after 10 seconds (using vector(1)), used to verify that the Alertmanager → am2gotify → Gotify notification flow works.
🌐
SigNoz
signoz.io › guides › how to merge zero values with metrics in promql - a guide
How to Merge Zero Values with Metrics in PromQL - A Guide | SigNoz
October 22, 2024 - The vector(0) function in PromQL converts the scalar value 0 into a vector, assigning a constant 0 to all active time series at the current evaluation time. In particular, the vector(0) function has the following behavior: Current Time Evaluation: Prometheus evaluates the query at a specific timestamp, and vector(0) applies the value 0 to all time series in the query context.
Top answer
1 of 10
42

Summary from

  • Understanding Prometheus Range Vectors
  • The Anatomy of a PromQL Query

  • What’s a Vector?
    • Since Prometheus is a timeseries database, all data is in the context of some timestamp. The series that maps a timestamp to recorded data is called a timeseries
    • a set of related timeseries is called a vector
    • Ex.
      • http_requests_total is a vector representing the total number of http requests received by a service
      • http_requests_total{code="200"} http_requests_total refers to the entire set of timeseries that are named that. And by appending a {code="200"}, we’re selecting a subset.
  • Types of Vectors
    • Instant vector - a set of timeseries where every timestamp maps to a single data point at that “instant”
      • Imagine evaluating the expression http_requests_total at a given timestamp. http_requests_total is an instant vector selector that selects the latest sample for any time series with the metric name http_requests_total. More specifically, "latest" means "at most 5 minutes old and not stale", relative to the evaluation timestamp. So this selector will only yield a result for series that have a sample at most 5 minutes prior to the evaluation timestamp, and where the last sample before the evaluation timestamp is not a stale marker (an explicit way of marking a series as terminating at a certain time in the Prometheus TSDB).
    • Range vector - a set of timeseries where every timestamp maps to a “range” of data points, recorded some duration into the past.
      • Range vector is mostly used for graphs, where you want to show a PromQL expression over a given time range. A range query works exactly like many completely independent instant queries that are evaluated at subsequent time steps over a given range of time. Of course, this is highly optimized under the hood and Prometheus doesn't actually run many independent instant queries in this case.
  • Differences
    • Instant vectors can be charted; Range vectors cannot. This is because charting something involves displaying a data point on the y-axis for every timestamp on the x-axis. Instant vectors have a single value for every timestamp, while range vectors have many of them. For the purpose of charting a metric, it is undefined1 how to show multiple data points for a single timestamp in a timeseries.
    • Instant vectors can be compared and have arithmetic performed on them; Range vectors cannot. This is also due to the way comparison and arithmetic operators are defined. For every timestamp, if we have multiple values, we don’t know how to add1 or compare them to another timeseries of a similar nature.
    • Range Vectors for counters. We take the instant vector and append our duration [15m]. This part is called the range selector and it transforms the instant vector into a range vector. We then use a function like increase which effectively subtracts the data point at the start of the range from the one at the end. increase(http_requests_total{code="200",handler="/api/v1/query"}[15m]) represent it is the increase in the total number of requests over the past fifteen minutes
2 of 10
24

VictoriaMetrics author here. This is Prometheus-like monitoring system, which supports PromQL-like query language - MetricsQL.

The instant vector and range vector are indeed confusing terms in Prometheus. That's why these terms are avoided in VictoriaMetrics docs. Prometheus query language - PromQL - provides various functions, which can be divided into two groups:

  • Functions, which accept only instant vector. Such functions can be split into the following subgroups:
    • transform functions, which apply various transformations individually per each input time series. For example, abs()
    • label manipulation functions, which modify labels and metric names for the input time series. For example, label_replace()
    • aggregate functions, which aggregate multiple input time series into specified groups of output time series. For example, sum(). Fun fact is that aggregate functions are named aggregation operators in Prometheus - see these docs.
  • Functions, which accept only range vector. VictoriaMetrics names such functions as rollup functions, since they calculate the result based on input time series samples over the given lookbehind window specified in square brackets (aka sliding window). For example, rate(http_requests_total[5m]) calculates the average per-second increase rate for http_requests_total time series over the last 5 minutes.

From user's perspective the only difference between instant vector and range vector is that range vector is constructed from the instant vector by adding a lookbehind window in square brackets. For example, http_requests_total is an instant vector, while http_requests_total[5m] is a range vector. I'd say that the range vector syntax is just a syntactic sugar for rollup functions in PromQL. E.g. rate(m[d]) could be written as rate(m, d), e.g. the lookbehind window d could be passed as a separate argument to rollup functions.

🌐
Google
docs.cloud.google.com › google cloud observability › managed rule evaluation and alerting
Managed rule evaluation and alerting | Google Cloud Observability | Google Cloud Documentation
The Rules resource provides a compatible interface to Prometheus rules to provide a seamless migration path for incorporating existing rules into managed rule evaluation. You can include your existing rules in a Rules resource. For example, the following is a Prometheus rule: groups: - name: example interval: 30s rules: - record: job:up:sum expr: sum without(instance) (up) - alert: AlwaysFiring expr: vector(1)
Find elsewhere
🌐
FOSS TechNix
fosstechnix.com › home › vectors in prometheus with examples
Vectors in Prometheus with Examples
February 18, 2024 - Below are some key point about Instant Vector in Prometheus · Represent a single snapshot of data at a specific timestamp. Useful for monitoring current values like system stats, resource usage, etc.
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › functions
Query functions | Prometheus
For each timeseries in v, label_join(v instant-vector, dst_label string, separator string, src_label_1 string, src_label_2 string, ...) joins all the values of all the src_labels using separator and returns the timeseries with the label dst_label containing the joined value. There can be any number of src_labels in this function. label_join acts on float and histogram samples in the same way. This example will return a vector with each time series having a foo label with the value a,b,c added to it:
🌐
Satyanash
satyanash.net › software › 2021 › 01 › 04 › understanding-prometheus-range-vectors.html
Understanding Prometheus Range Vectors - Satyajeet Kanetkar
January 4, 2021 - Prometheus allows exactly one case where a counter value may decrease, and that is during a target restart. If a counter value drop below a previous recorded value, range vector functions like rate and increase will assume that the target restarted ...
🌐
VictoriaMetrics
victoriametrics.com › blog › prometheus monitoring: instant queries and range queries explained
Prometheus Monitoring: Instant Queries and Range Queries Explained
February 21, 2025 - Since an instant query runs only once, it naturally returns a single sample per timeseries. This is why instant queries typically return instant vectors—though, as we’ll see later, that’s not always the case.
🌐
KodeKloud Notes
notes.kodekloud.com › docs › Prometheus-Certified-Associate-PCA › PromQL › Vector-Matching
Vector Matching - KodeKloud Notes
This article explores vector matching in PromQL, focusing on arithmetic operations between instant vectors with shared and differing labels.
🌐
StackShare
stackshare.io › stackups › prometheus-vs-vector
Prometheus vs Vector | What are the differences?
Vector, on the other hand, focuses more on log management and processing. It offers features such as log parsing, filtering, and transformation, making it suitable for log aggregation, enrichment, and routing. Architecture Design: Prometheus is a standalone service that operates as a single ...
🌐
DevOps.dev
blog.devops.dev › prometheus-metrics-labels-filters-or-metadata-7b973de4b96e
Prometheus metrics labels — filters or metadata? | by Joseph Esrig | DevOps.dev
April 17, 2024 - Prometheus provides us with arithmetic binary operators which can be used in a traditional manner. However, because of the fact that anything multiplied by 1 is the original value, this provides us a little trick we can play with our * operator.
🌐
NSRC
nsrc.org › workshops › 2021 › sanog37 › nmm › netmgmt › en › prometheus › ex-promql-basic.htm
ex-promql-basic
It’s a “vector” because there are multiple values in a column, and these values all apply to the same instant in time - the current time. When you ask prometheus for the value of a metric at a particular instant in time, it gives you the most recent scrape value which occurred before ...
🌐
Iximiuz
iximiuz.com › en › posts › prometheus-vector-matching
Prometheus Cheat Sheet - How to Join Multiple Metrics (Vector Matching)
November 30, 2021 - How to join metrics on matching labels? Vector matching: one-to-one, one-to-many and many-to-one, many-to-many. What on/ignoring clause is for? group_left and group_right explained. Logical/set operations explained.
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › operators
Operators | Prometheus
Vector elements which find a match on the other side of the expression but for which the expression is false instead have the value 0, and vector elements that do find a match and for which the expression is true have the value 1.
🌐
Logz.io
logz.io › home › blog › how to › an intro to promql: basic concepts & examples
An Intro to PromQL: Basic Concepts & Examples | Logz.io
September 2, 2023 - Prometheus returns multiple values for a single query, thanks to the PromQL built-in “OR” operator “|” · Instant vectors can be queries simply by identifying the metric name. You can filter these values by referring to labels within curly brackets. Labels also include vector matching to either ignore or pay attention to a certain keyword, both in 1...