REFRESH DATABASE
There are two types of databases that can be refreshed: database shares and databases attached to read-scaling connections.
Read-scaling connections sync automatically every minute. To ensure maximum freshness, run CREATE SNAPSHOT
on the
writer, followed by REFRESH DATABASE
on the reader. This pulls the latest snapshot.
Database shares can also be refreshed—either automatically or manually. In this case, the writer uses UPDATE SHARE
instead of CREATE SNAPSHOT
, followed by REFRESH DATABASE
on the reader.
REFRESH DATABASES; -- Refreshes all connected databases and shares
┌─────────┬───────────────────┬──────────────────────────┬───────────┐
│ name │ type │ fully_qualified_name │ refreshed │
│ varchar │ varchar │ varchar │ boolean │
├─────────┼───────────────────┼──────────────────────────┼───────────┤
│ <name1> │ motherduck │ md:<name> │ false │
│ <name2> │ motherduck share │ md:_share/<name2>/<uuid> │ true │
└─────────┴───────────────────┴──────────────────────────┴───────────┘
REFRESH DATABASE my_db; -- Alternatively, refresh a specific database
┌─────────┬──────────────────┬──────────────────────────┬───────────┐
│ name │ type │ fully_qualified_name │ refreshed │
│ varchar │ varchar │ varchar │ boolean │
├─────────┼──────────────────┼──────────────────────────┼───────────┤
│ <name1> │ motherduck share │ md:_share/<name1>/<uuid> │ false │
└─────────┴──────────────────┴──────────────────────────┴───────────┘
Lean more about CREATE SNAPSHOT and UPDATE SHARE.