Skip to content

Commit 43a01be

Browse files
authored
Merge pull request dolthub#2532 from dolthub/max-hoffman-patch-3
Update dolt-sql-procedures.md
2 parents 88a196b + e8a7828 commit 43a01be

File tree

1 file changed

+32
-20
lines changed

1 file changed

+32
-20
lines changed

packages/dolt/content/reference/sql/version-control/dolt-sql-procedures.md

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ title: Dolt SQL Procedures
3030
- [Statistics Updates](#statistics-updates)
3131
- [dolt_stats_restart()](#dolt_stats_restart)
3232
- [dolt_stats_stop()](#dolt_stats_stop)
33-
- [dolt_stats_status()](#dolt_stats_status)
34-
- [dolt_stats_drop()](#dolt_stats_drop)
33+
- [dolt_stats_purge()](#dolt_stats_purge)
34+
- [dolt_stats_once()](#dolt_stats_once)
35+
- [dolt_stats_wait()](#dolt_stats_wait)
36+
- [dolt_stats_flush()](#dolt_stats_flush)
37+
- [dolt_stats_gc()](#dolt_stats_gc)
38+
- [dolt_stats_info()](#dolt_stats_info)
3539
- [Access Control](#access-control)
3640
# Dolt SQL Procedures
3741

@@ -1634,38 +1638,46 @@ See [stats documentation](../sql-support/miscellaneous.md#stats-controller-funct
16341638
## `dolt_stats_restart()`
16351639

16361640
If no thread is active for the current database, start a new update
1637-
thread with the current session's interval and threshold parameters
1638-
(`dolt_stats_auto_refresh_interval` and
1639-
`dolt_stats_auto_refresh_threshold`). If a thread is already active for
1641+
thread with the current session's parameters (`dolt_stats_memory_only`, `dolt_stats_job_interval`, `dolt_stats_gc_enabled`).
1642+
If a thread is already active for
16401643
this database, the thread is stopped and started with the new
16411644
parameters.
16421645

16431646
## `dolt_stats_stop()`
16441647

1645-
Stop the update thread for the current database
1648+
Clears the work queue and stops the thread
16461649
(otherwise no-op).
16471650

1648-
## `dolt_stats_status()`
1651+
## `dolt_stats_purge()`
16491652

1650-
Returns the latest update to statistics for the current database.
1653+
Deletes the stats cache from memory and the filesystem. Also clearing working queue and stop the update thread.
16511654

1652-
## `dolt_stats_drop()`
1655+
## `dolt_stats_once()`:
16531656

1654-
Deletes the stats ref on disk and wipes the database stats held in memory for the current database.
1655-
Stops update thread if active.
1657+
This command collects statistics once. It should be used when no background thread is running
1658+
(ex: in `dolt sql` and when we do not wish to run a background thread).
16561659

1657-
## `dolt_stats_prune()`
1660+
## `dolt_stats_wait()`:
16581661

1659-
Garbage collect the statistics cache storage, retaining only
1660-
the most recent statistic updates. Background threads need to be
1661-
restarted after this operation.
1662+
Blocks on a full queue cycle. In practice it takes at least one cycle for stats to reflect the contents
1663+
of the database stats in the blocking session.
16621664

1663-
## `dolt_stats_purge()`
1665+
## `dolt_stats_gc()`:
1666+
1667+
Blocks waiting for a GC signal. Garbage collection finalizes in the same cadence as new statistic updates.
1668+
1669+
## `dolt_stats_flush()`:
1670+
1671+
Blocks waiting on a flush signal. Flushes occur after new statistic updates.
16641672

1665-
Delete the old statistics cache from the
1666-
filesystem. This can be used to silence warnings from backwards
1667-
incompatible upgrades. Statistics will need
1668-
to be recollected, which can be time consuming.
1673+
## `dolt_stats_info()`:
1674+
1675+
Returns the current state of the stats provider (optional `'-short'` flag).
1676+
1677+
```sql
1678+
> call dolt_stats_info('--short');
1679+
{""dbCnt":1,"active":false,"storageBucketCnt":2,"cachedBucketCnt":2,"cachedBoundCnt":2,"cachedTemplateCnt":4,"statCnt":2,"backing":""repo2""}
1680+
```
16691681
16701682
# Access Control
16711683
Dolt stored procedures are access controlled using the GRANT permissions system. MySQL database permissions trickle down to tables and procedures, someone who has Execute permission on a database would have Execute permission on all procedures related to that database. Dolt deviates moderately from this behavior for sensitive operations. See [Administrative Procedures](#administrative-procedures) below.

0 commit comments

Comments
 (0)