diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 902b6d0cf5..4da655fb8a 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -15,6 +15,7 @@ The following tip changes can be tested by building VictoriaMetrics components f
 
 ## v1.79.x long-time support release (LTS)
 
+* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly parse `M` and `Mi` suffixes as `1e6` multipliers in `1M` and `1Mi` numeric constants. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3664). The issue has been introduced in [v1.79.7](https://docs.victoriametrics.com/CHANGELOG.html#v1797).
 
 ## [v1.79.7](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.79.7)
 
diff --git a/go.mod b/go.mod
index bba870669c..7b929574fa 100644
--- a/go.mod
+++ b/go.mod
@@ -9,8 +9,8 @@ require (
 	// Do not use the original github.com/valyala/fasthttp because of issues
 	// like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b
 	github.com/VictoriaMetrics/fasthttp v1.1.0
-	github.com/VictoriaMetrics/metrics v1.23.0
-	github.com/VictoriaMetrics/metricsql v0.51.1
+	github.com/VictoriaMetrics/metrics v1.23.1
+	github.com/VictoriaMetrics/metricsql v0.51.2
 	github.com/aws/aws-sdk-go v1.44.177
 	github.com/cespare/xxhash/v2 v2.2.0
 
diff --git a/go.sum b/go.sum
index 80c41e5868..779628bfc3 100644
--- a/go.sum
+++ b/go.sum
@@ -89,10 +89,10 @@ github.com/VictoriaMetrics/fastcache v1.12.0/go.mod h1:tjiYeEfYXCqacuvYw/7UoDIeJ
 github.com/VictoriaMetrics/fasthttp v1.1.0 h1:3crd4YWHsMwu60GUXRH6OstowiFvqrwS4a/ueoLdLL0=
 github.com/VictoriaMetrics/fasthttp v1.1.0/go.mod h1:/7DMcogqd+aaD3G3Hg5kFgoFwlR2uydjiWvoLp5ZTqQ=
 github.com/VictoriaMetrics/metrics v1.18.1/go.mod h1:ArjwVz7WpgpegX/JpB0zpNF2h2232kErkEnzH1sxMmA=
-github.com/VictoriaMetrics/metrics v1.23.0 h1:WzfqyzCaxUZip+OBbg1+lV33WChDSu4ssYII3nxtpeA=
-github.com/VictoriaMetrics/metrics v1.23.0/go.mod h1:rAr/llLpEnAdTehiNlUxKgnjcOuROSzpw0GvjpEbvFc=
-github.com/VictoriaMetrics/metricsql v0.51.1 h1:gmh3ZGCDrqUTdhUrr87eJOXMOputDYs1PtLwTfySTsI=
-github.com/VictoriaMetrics/metricsql v0.51.1/go.mod h1:6pP1ZeLVJHqJrHlF6Ij3gmpQIznSsgktEcZgsAWYel0=
+github.com/VictoriaMetrics/metrics v1.23.1 h1:/j8DzeJBxSpL2qSIdqnRFLvQQhbJyJbbEi22yMm7oL0=
+github.com/VictoriaMetrics/metrics v1.23.1/go.mod h1:rAr/llLpEnAdTehiNlUxKgnjcOuROSzpw0GvjpEbvFc=
+github.com/VictoriaMetrics/metricsql v0.51.2 h1:GCbxti0I46x3Ld/WhcUyawvLr6J0x90IaMftkjosHJI=
+github.com/VictoriaMetrics/metricsql v0.51.2/go.mod h1:6pP1ZeLVJHqJrHlF6Ij3gmpQIznSsgktEcZgsAWYel0=
 github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
 github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
 github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
diff --git a/vendor/github.com/VictoriaMetrics/metrics/process_metrics_linux.go b/vendor/github.com/VictoriaMetrics/metrics/process_metrics_linux.go
index 005af82f32..48def1cba7 100644
--- a/vendor/github.com/VictoriaMetrics/metrics/process_metrics_linux.go
+++ b/vendor/github.com/VictoriaMetrics/metrics/process_metrics_linux.go
@@ -9,6 +9,7 @@ import (
 	"os"
 	"strconv"
 	"strings"
+	"sync/atomic"
 	"time"
 )
 
@@ -48,6 +49,7 @@ func writeProcessMetrics(w io.Writer) {
 		log.Printf("ERROR: metrics: cannot open %s: %s", statFilepath, err)
 		return
 	}
+
 	// Search for the end of command.
 	n := bytes.LastIndex(data, []byte(") "))
 	if n < 0 {
@@ -85,12 +87,20 @@ func writeProcessMetrics(w io.Writer) {
 	writeIOMetrics(w)
 }
 
+var procSelfIOErrLogged uint32
+
 func writeIOMetrics(w io.Writer) {
 	ioFilepath := "/proc/self/io"
 	data, err := ioutil.ReadFile(ioFilepath)
 	if err != nil {
-		log.Printf("ERROR: metrics: cannot open %q: %s", ioFilepath, err)
+		// Do not spam the logs with errors - this error cannot be fixed without process restart.
+		// See https://github.com/VictoriaMetrics/metrics/issues/42
+		if atomic.CompareAndSwapUint32(&procSelfIOErrLogged, 0, 1) {
+			log.Printf("ERROR: metrics: cannot read process_io_* metrics from %q, so these metrics won't be updated until the error is fixed; "+
+				"see https://github.com/VictoriaMetrics/metrics/issues/42 ; The error: %s", ioFilepath, err)
+		}
 	}
+
 	getInt := func(s string) int64 {
 		n := strings.IndexByte(s, ' ')
 		if n < 0 {
diff --git a/vendor/github.com/VictoriaMetrics/metricsql/lexer.go b/vendor/github.com/VictoriaMetrics/metricsql/lexer.go
index c3aebd80d3..f0dec0a821 100644
--- a/vendor/github.com/VictoriaMetrics/metricsql/lexer.go
+++ b/vendor/github.com/VictoriaMetrics/metricsql/lexer.go
@@ -289,6 +289,9 @@ func scanPositiveNumber(s string) (string, error) {
 }
 
 func scanNumMultiplier(s string) int {
+	if len(s) > 3 {
+		s = s[:3]
+	}
 	s = strings.ToLower(s)
 	switch true {
 	case strings.HasPrefix(s, "kib"):
@@ -616,7 +619,6 @@ func scanSingleDuration(s string, canBeNegative bool) int {
 	if len(s) == 0 {
 		return -1
 	}
-	s = strings.ToLower(s)
 	i := 0
 	if s[0] == '-' && canBeNegative {
 		i++
@@ -637,14 +639,26 @@ func scanSingleDuration(s string, canBeNegative bool) int {
 			return -1
 		}
 	}
-	switch s[i] {
+	switch unicode.ToLower(rune(s[i])) {
 	case 'm':
-		if i+1 < len(s) && s[i+1] == 's' {
-			// duration in ms
-			return i + 2
+		if i+1 < len(s) {
+			switch unicode.ToLower(rune(s[i+1])) {
+			case 's':
+				// duration in ms
+				return i + 2
+			case 'i', 'b':
+				// This is not a duration, but Mi or MB suffix.
+				// See parsePositiveNumber() and https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3664
+				return -1
+			}
 		}
-		// duration in minutes
-		return i + 1
+		// Allow small m for durtion in minutes.
+		// Big M means 1e6.
+		// See parsePositiveNumber() and https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3664
+		if s[i] == 'm' {
+			return i + 1
+		}
+		return -1
 	case 's', 'h', 'd', 'w', 'y', 'i':
 		return i + 1
 	default:
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 9a995883f8..d2c41b746b 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -28,10 +28,10 @@ github.com/VictoriaMetrics/fastcache
 github.com/VictoriaMetrics/fasthttp
 github.com/VictoriaMetrics/fasthttp/fasthttputil
 github.com/VictoriaMetrics/fasthttp/stackless
-# github.com/VictoriaMetrics/metrics v1.23.0
+# github.com/VictoriaMetrics/metrics v1.23.1
 ## explicit; go 1.15
 github.com/VictoriaMetrics/metrics
-# github.com/VictoriaMetrics/metricsql v0.51.1
+# github.com/VictoriaMetrics/metricsql v0.51.2
 ## explicit; go 1.13
 github.com/VictoriaMetrics/metricsql
 github.com/VictoriaMetrics/metricsql/binaryop