我正在遵循本指南:Monitoring Performance By Use the Query Store
但是,当我在 SMSS 2016 CTP3.2 上打开 Azure 数据库并展开数据库树时,查询存储/回归查询或任何其他选项都可用。
我希望能够进行 IO 消耗最多的查询并分析执行计划。
我还需要启用什么吗?
sys.databases中相关的is_query_store_on列显示 0,但数据库属性表明它已启用。我执行了,但is_query_store_on仍然保持在 0。ALTER DATABASE <DB> SET QUERY_STORE = ON;
以下查询:
SELECT
actual_state, actual_state_desc, readonly_reason,
current_storage_size_mb, max_storage_size_mb
FROM sys.database_query_store_options;
Run Code Online (Sandbox Code Playgroud)
显示实际状态= 2;
根据postgresql uuid-ossp文档uuid_generate_v1()
是基于Mac地址+时间戳:
https://www.postgresql.org/docs/9.4/static/uuid-ossp.html
在分布式数据库场景中,我们有数百个数据库使用 UUID 键生成记录并同步回中央数据库。
假设我们检测到一台机器将来的日期/时间错误,我们将其改回正确的日期/时间。它可能会在此特定计算机上生成冲突的 UUID 密钥吗?
一种情况是夏令时/夏令时。
这很快(49ms):
v_cpf_numerico := ext.uf_converte_numerico(new.nr_cpf);
select cd_cliente into v_cd_cliente
from central.cliente where nr_cpf_cnpj = v_cpf_numerico;
Run Code Online (Sandbox Code Playgroud)
这很慢(15 秒):
select cd_cliente into v_cd_cliente
from central.cliente where nr_cpf_cnpj = ext.uf_converte_numerico(new.nr_cpf);
Run Code Online (Sandbox Code Playgroud)
功能:
create or replace function ext.uf_converte_numerico(_input varchar(30)) returns bigint
as
$$
begin
_input := regexp_replace(_input, '[^0-9]+', '', 'g');
if _input = '' then
return null;
end if;
return cast(_input as bigint);
end
$$ language plpgsql;
Run Code Online (Sandbox Code Playgroud)
我使用的是 PostgreSQL 12。
为什么第二个变体很慢?
postgresql performance functions postgresql-12 query-performance
postgresql ×2
functions ×1
performance ×1
query-store ×1
random ×1
sql-server ×1
time ×1
uuid ×1