- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
环境:postgres: 9.5
表格:
segmentation=> \d+ sourceTable;
Table
"sourceTable" Column | Type | Modifiers | Storage | Stats target | Description
-----------------------------+--------------------------+------------------------+----------+--------------+-------------
tracking_id | character varying(40) | not null | extended | |
attributes | jsonb | not null | extended | |
last_modification_timestamp | timestamp with time zone | not null default now() | plain | |
version | bigint | not null default 1 | plain | |
Indexes:
"client_attributes_pkey" PRIMARY KEY, btree (tracking_id)
属性字段是jsonb。它可以是一个巨大的 json。所以 Postgres 创建了 TOAST 表来存储该列。
TOAST 表的统计信息
segmentation=> select * from "pg_catalog"."pg_stat_all_tables" where relname='pg_toast_237733296';
relid | schemaname | relname | seq_scan | seq_tup_read | idx_scan | idx_tup_fetch | n_tup_ins | n_tup_upd | n_tup_del | n_tup_hot_upd | n_live_tup | n_dead_tup | n_mod_since_analyze | last_vacuum | last_autovacuum | last_analyze | last_auto
analyze | vacuum_count | autovacuum_count | analyze_count | autoanalyze_count
-----------+------------+--------------------+----------+--------------+-----------+---------------+-----------+-----------+-----------+---------------+------------+------------+---------------------+--------------------------------------------+--------------+------------------+--------------+------------------+---------------+-------------------
237733301 | pg_toast | pg_toast_237733296 | 1 | 0 | 710119316 | 1138457190 | 236069110 | 0 | 235760336 | 0 | 9231431 | 8769021 | 471829446 | | 2018-01-29 06:13:29.169999+00 | |
| 0 | 568 | 0 | 0
问题:toast table 的大小无限增长。虽然数据量不是很大。
例如:全真空前
relation | size
-----------------------------------------+---------
pg_toast.pg_toast_237738400 | 75 GB
完全真空后
relation | size
-----------------------------------------+---------
pg_toast.pg_toast_237738400 | 416 MB
为什么 autovacuum 没有帮助(使用默认配置运行)?可以做些什么来解决这个问题?
segmentation=> select name, setting from pg_settings where name like 'autovacuum%';
name | setting
-------------------------------------+-----------
autovacuum | on
autovacuum_analyze_scale_factor | 0.1
真空冗长的结果
segmentation=> VACUUM (VERBOSE) ss_admin.client_attributes;
INFO: vacuuming "ss_admin.client_attributes"
INFO: scanned index "client_attributes_pkey" to remove 89097 row versions
DETAIL: CPU 0.11s/0.75u sec elapsed 1.32 sec.
INFO: "client_attributes": removed 89097 row versions in 85197 pages
DETAIL: CPU 0.87s/0.44u sec elapsed 12.00 sec.
INFO: index "client_attributes_pkey" now contains 2462438 row versions in 17738 pages
DETAIL: 88338 index row versions were removed.
0 index pages have been deleted, 0 are currently reusable.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO: "client_attributes": found 132824 removable, 2463417 nonremovable row versions in 404663 out of 404860 pages
DETAIL: 5295 dead row versions cannot be removed yet.
There were 46898 unused item pointers.
Skipped 0 pages due to buffer pins.
0 pages are entirely empty.
CPU 3.13s/2.36u sec elapsed 32.41 sec.
INFO: vacuuming "pg_toast.pg_toast_237738400"
INFO: scanned index "pg_toast_237738400_index" to remove 370799 row versions
DETAIL: CPU 0.01s/0.10u sec elapsed 0.17 sec.
INFO: "pg_toast_237738400": removed 370799 row versions in 93742 pages
DETAIL: CPU 0.65s/0.28u sec elapsed 5.84 sec.
INFO: index "pg_toast_237738400_index" now contains 301508 row versions in 2332 pages
DETAIL: 353494 index row versions were removed.
0 index pages have been deleted, 0 are currently reusable.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO: "pg_toast_237738400": found 315275 removable, 301508 nonremovable row versions in 128628 out of 128628 pages
DETAIL: 1779 dead row versions cannot be removed yet.
There were 70590 unused item pointers.
Skipped 0 pages due to buffer pins.
0 pages are entirely empty.
CPU 1.49s/0.76u sec elapsed 9.80 sec.
最佳答案
正常的 VACUUM
和 autovacuum 不会收缩表,它只会使可用空间可供重用。
如果你想回收空间,你必须使用VACUUM (FULL)
。除非您运行批量删除或更新,否则没有必要这样做。
关于postgresql - Postgres : toast table + space + vacuum,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48502820/
这个问题在这里已经有了答案: How to prevent Multiple Toast Overlaps (8 个答案) 关闭 6 年前。 我有很多按钮。点击它们中的每一个,我都会显示一个 toa
我想为 Windows Phone 8.1 开发一个包含本地“通知”的通用应用程序。 我想要做的是在 toast 控件的扭结中向用户显示所有消息(错误、信息、警告)。 一切都在本地完成,无需通过标准通
有没有办法在 ionic 2 toast 中设置文本消息的样式? 我试过这个: let toast = Toast.create({ message: "Some text on
我有一个附加到按钮的函数,按下该按钮将从数组列表中删除一个项目,然后显示一个提示“项目已删除!”。如果我多次按下删除按钮,那么所有的 toast 都会显示出来,使其看起来像一个非常长的 toast 显
我在这里读到过此类问题,但答案似乎不起作用。 当用户点击按钮时,我会显示一个Toast。当用户连续点击按钮时,即使用户退出 Activity ,toast 也会一次又一次地显示。 toast 的长度很
我有几个可以在 fragment 上单击的按钮。单击每个按钮后,我会显示一条 Toast 消息,每个按钮都完全相同。因此,如果你一个接一个地按下 5 个不同的按钮,你将叠加 5 个 toast 消息,
我有几个 SeekBar 和 onSeekBarProgressStop(),我想显示一个 Toast 消息。 但是,如果在 SeekBar 上我快速执行操作,那么 UI 线程会以某种方式阻塞并且 T
有没有办法在 android 中获取与特定 android Toast 对象关联的消息? toast=Toast.makeText(getAppContext(), message, Toast.LE
我正在创建我的自定义 toast,主要是因为我将它放在 GridView 上并且需要对其宽度进行一些控制。但我真的很喜欢标准 toast 上的淡蓝色光环,并希望恢复它(或者至少让我的自定义 toast
我正在使用 Espresso 测试一个应用程序。我有一个问题,是否可以等到当前没有 toast 显示。我的应用程序中有很多不同的 toast,但是在测试时我遇到了问题,因为据我所知,焦点已经转移到 t
这可能是一个新手问题,但我想知道为什么我们必须使用静态方法 (makeText) 来创建 Toast 而不是构造函数。 为什么我们必须使用这个: makeText(Context context, C
我想显示的 toast 少于 Toast.LENGTH_SHORT,因为我觉得它需要大约 2 秒。我只想显示 toast 半秒。 Toast.LENGTH_SHORT 和 Toast.LENGTH_L
我想向用户显示自定义 toast。但 toast.getView() 和 toast.setView() 在 android studio 中已弃用。 这是我的代码: Toast toast = To
如何在 WorkManager 中显示 toast do work()? 当我尝试时,它会抛出 Caused by: java.lang.RuntimeException: Can't create
我写了一个代码,它工作正常,但没有任何 toast 出现。 Activity 2: package com.example.kiit.questionme2; import android.conte
我刚刚开始学习 Android。我使用我的 MIUI 10 设备进行调试。 我已经学习了非常基础的 App Lifecycle Program。问题是,我正在使用 toasts 来显示何时调用每个方法
我有一条消息在执行后不会消失。我猜这与它处于循环中有关,但我不确定。有人可以帮我弄清楚为什么 toast 消息没有区别吗? @Override public void onClick(View v)
是否可以让手机在您的程序中收到任何 toast 消息时振动?还是必须在每个 toast 上插入振动命令? 干杯。 最佳答案 将此类添加到您的代码中: import android.content.Co
有谁知道为什么这个程序不显示 toast 消息? public class Main extends Activity implements OnClickListener{ /** Called w
我在我的应用程序中打印 Toast 消息以显示通知,但我想知道Toast.LENGTH_LONG 和 Toast.LENGTH_SHORT。我可以使用哪些其他值。 谁能告诉我这两个变量的值是多少? 最
我是一名优秀的程序员,十分优秀!