问题标签 [mariadb-10.3]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
121 浏览

mysql - Mysql员工休息时间历史与时差

我有带有inoutmode标志的员工生物特征日志数据。我正在尝试获取详细的休息时间列表和时差。

inoutmode4 为突破,5 为闯入。

这是我想要的输出

我尽力实现输出。以下是我尝试的查询:

我的 MySQL 版本 = 10.3.17-MariaDB-1-log

部分我使用案例条件到达了记录,但 4 和 5 inoutmode 应该在单行中以计算时间差。任何的想法...

任何建议表示赞赏。

0 投票
0 回答
158 浏览

mariadb - MariaDB 10.3.18 不识别任何命令行选项

我有一个 CentOS 7 盒子,上面安装了 Mariadb 10.3.18 从 mariadb 存储库。在最近通过 yum 更新后,mysqld 不再接受任何命令行参数:

除了 --help 之外的任何其他参数都会发生这种情况。这是最新的 mariadb 版本中的错误还是我遗漏了什么?

0 投票
1 回答
40 浏览

mysql - 对于表a中的每条记录,返回表b中日期最接近但大于now()的记录

服务器版本:10.3.15-MariaDB-log

我有这样的数据结构

我只想获取将来有约会的参与者,并且如果他们未来约会的位置是移动位置类型,我只想返回这些参与者。但是,我只关心他们最近的约会地点。我需要在单个查询中执行此操作。我已经到了这个阶段,在这里我可以获取所有位置的 locationType,对于所有比现在更大的约会,对于所有人,但我需要将其限制为仅在未来最近的约会并且不知道如何继续。

0 投票
2 回答
104 浏览

mysql - MariaDB 中的并发事务有限制吗?

有带有 Asterisk PBX 11.25.3 和 mysql Ver 15.1 Distrib 10.3.18-MariaDB 的 Centos 7 服务器,适用于 Linux (x86_64)。

extensions.conf:

sip.conf:

当来自中继的同时呼叫超过 15-20 个时,我收到消息:

MariaDB 中的并发事务有限制吗?

0 投票
0 回答
71 浏览

mariadb - MariaDB 10.3 序列编号的间隙

我有一个表,其中 id 是主键和序列。在事务中我调用序列

然后创建一个新记录,其中字段 id = next_cons_id 从下面的代码中获得。

DDL 序列

在大多数情况下,它运作良好。做了一项小型研究后,我发现了一些模式。

带日期的 ID:

在我创建了控制台脚本之后,该脚本每秒在测试表中插入一条记录:

它表只使用测试脚本。

但是是时候我们可以看到一些问题了: 在此处输入图像描述

此时没有网络问题 在此处输入图像描述

在监控zabbix回滚事务时未发现。

数据库有一个复制服务器。

服务器版本:10.3.13

你有什么想法来解决这个问题吗?

UPD:我删除了序列并重新创建了这个表, id primary key autouncrement但是这种情况已经重复了。

0 投票
0 回答
142 浏览

docker - 如何在升级时执行 /docker-entrypoint-initdb.d 中的 Mariadb 初始化脚本

作为 mariadb 实例(容器)升级的一部分,我需要创建一些新表。所以我在 /docker-entrypoint-initdb.d 中复制了 update.sql 脚本,但是当我进行升级时,这不会被调用。

当我创建一个新的实例时,同样的事情。

0 投票
1 回答
917 浏览

mysql - MariaDB/Mysql SELECT on CASE Statement inside CAST causes an error

I'm working with a frustrating set of data that contains null, 0, 1, and 2 values for the 'active' column in my users table.

Why does this work:

But not this?

I want to cast one of my query results as a boolean so it returns true or false but when I add CAST() I get an error (near BOOLEAN)

Running MariaDB 10.3

0 投票
1 回答
259 浏览

sql - JSON_ARRAY 未在 MariaDB 上发送空列表

当我使用 JSON_ARRAY函数时,我在 MariaDB (10.3.18) 中遇到问题,如果我的子查询没有任何结果,它不会给我一个空数组,它会给我一个包含 1 个空结果的数组。

示例:

目前,我找到了一种通过使用REPLACE如下函数来解决这个问题的方法:

但是,如果有什么东西可以告诉 MariaDB 发送一个空结果而不是 NULL 结果,它会对我有很大帮助!

0 投票
3 回答
455 浏览

mysql - mysql not using index on simple OR condition

I have ran into the age-old problem of MySQL refusing to use an index for seemingly basic stuff. The query in question:

EXPLAIN:

There are indexes on external_id and external_context separately, and I also tried adding a composite index (idx_app_comments_externals), but that did not help at all.

The query executes in 4-6 seconds in production (>1m records), but removing the OR part of the WHERE condition decreases that to 0.05s (it still uses filesort though). Clearly indexes don't work here, but I have no idea why. Can anyone explain this?

P.S. We're using MariaDB 10.3.18, could that be at fault here?

0 投票
1 回答
70 浏览

mysql - MySQL select orderby date 返回重复值

我想得到每个用户和他们最后一次付款。我在这里有 2 张桌子usersfinances。我尝试添加groupby并得到了我想要的结果,但是它获得了另一个表中最旧的记录。有谁知道我怎么能做到这一点?

我的第一个查询

结果我得到

我只想要其他表中的最新记录。新应付款和新支付。

我尝试了第二个查询

它有效,但我得到了最古老的记录。