<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>SQL Procedures, Views &amp; Configuration Reference on Mooncake</title>
    <link>https://mooncake.pgsty.com/docs/reference/</link>
    <description>Recent content in SQL Procedures, Views &amp; Configuration Reference on Mooncake</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    
    
    
      <lastBuildDate>Thu, 05 Nov 2026 19:17:16 +0800</lastBuildDate>
    
    
      <atom:link href="https://mooncake.pgsty.com/docs/reference/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
        <title>Create Columnstore Table</title>
        <link>https://mooncake.pgsty.com/docs/reference/create-columnstore/</link>
        <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
        
        <guid>https://mooncake.pgsty.com/docs/reference/create-columnstore/</guid>
        <description>&lt;p&gt;In &lt;code&gt;pg_mooncake&lt;/code&gt;, columnstore tables are created as &lt;strong&gt;real-time mirrors&lt;/strong&gt; of existing PostgreSQL rowstore (heap or partitioned) tables using the &lt;code&gt;mooncake.create_table&lt;/code&gt; procedure.&lt;/p&gt;&#xA;&lt;h2 id=&#34;signature&#34;&gt;Procedure Signature&#xA;&lt;/h2&gt;&#xA;&lt;div class=&#34;td-code td-code--untitled&#34; id=&#34;td-code-12a76879-fence-0&#34; data-td-code data-td-code-auto-id&#xA;     data-td-language=&#34;sql&#34; data-td-line-count=&#34;6&#34;&gt;&#xA;  &lt;div class=&#34;td-code__viewport&#34; id=&#34;td-code-12a76879-fence-0-viewport&#34; data-td-code-viewport&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;CALL&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;mooncake&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;create_table&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dst&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;src&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;src_uri&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;text&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;DEFAULT&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;NULL&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;table_config&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;json&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;DEFAULT&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;NULL&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div class=&#34;td-table-scroll td-table-scroll--static&#34;&gt;&#xA;&lt;table class=&#34;wide expand td-table--wide&#34;&gt;&#xA;  &lt;thead&gt;&#xA;    &lt;tr&gt;&#xA;      &lt;th scope=&#34;col&#34; style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;&#xA;      &lt;th scope=&#34;col&#34; style=&#34;text-align: center&#34;&gt;Type&lt;/th&gt;&#xA;      &lt;th scope=&#34;col&#34; style=&#34;text-align: center&#34;&gt;Default&lt;/th&gt;&#xA;      &lt;th scope=&#34;col&#34; style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;&#xA;    &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;    &lt;tr&gt;&#xA;      &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;dst&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: center&#34;&gt;&lt;code&gt;text&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: center&#34;&gt;&lt;em&gt;(Required)&lt;/em&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: left&#34;&gt;Name of the destination columnstore mirror table to create (supports &lt;code&gt;schema.table&lt;/code&gt;, defaults to &lt;code&gt;public&lt;/code&gt; if unqualified).&lt;/td&gt;&#xA;    &lt;/tr&gt;&#xA;    &lt;tr&gt;&#xA;      &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;src&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: center&#34;&gt;&lt;code&gt;text&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: center&#34;&gt;&lt;em&gt;(Required)&lt;/em&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: left&#34;&gt;Name of the source PostgreSQL rowstore or partitioned table to replicate from (supports &lt;code&gt;schema.table&lt;/code&gt;).&lt;/td&gt;&#xA;    &lt;/tr&gt;&#xA;    &lt;tr&gt;&#xA;      &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;src_uri&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: center&#34;&gt;&lt;code&gt;text&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: center&#34;&gt;&lt;code&gt;NULL&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: left&#34;&gt;Connection URI (&lt;code&gt;postgresql://user:pass@host:port/dbname&lt;/code&gt;) of a remote PostgreSQL instance when replicating from an external database. When &lt;code&gt;NULL&lt;/code&gt;, replicates from the current local database.&lt;/td&gt;&#xA;    &lt;/tr&gt;&#xA;    &lt;tr&gt;&#xA;      &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;table_config&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: center&#34;&gt;&lt;code&gt;json&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: center&#34;&gt;&lt;code&gt;NULL&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;td style=&#34;text-align: left&#34;&gt;Optional JSON object configuring Moonlink storage and ingestion settings (such as &lt;code&gt;write_buffer_size&lt;/code&gt; or initial data copy behavior).&lt;/td&gt;&#xA;    &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&lt;div class=&#34;td-callout td-callout--important&#34; role=&#34;note&#34;&gt;&#xA;  &lt;div class=&#34;td-callout__title&#34;&gt;&lt;i class=&#34;td-callout__icon fa-solid fa-circle-exclamation&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;span class=&#34;td-callout__label&#34;&gt;Parameter Name: &lt;code&gt;src_uri&lt;/code&gt; (Not &lt;code&gt;source_uri&lt;/code&gt;)&lt;/span&gt;&lt;/div&gt;&#xA;  &lt;div class=&#34;td-callout__body&#34;&gt;&#xA;&lt;p&gt;Earlier upstream documentation contained a typo showing &lt;code&gt;source_uri =&amp;gt; &#39;postgresql://...&#39;&lt;/code&gt;. The actual parameter name in &lt;code&gt;pg_mooncake&lt;/code&gt;&amp;rsquo;s SQL definition (&lt;code&gt;src/functions.rs&lt;/code&gt;) is &lt;strong&gt;&lt;code&gt;src_uri&lt;/code&gt;&lt;/strong&gt;. Always use &lt;code&gt;src_uri =&amp;gt; &#39;postgresql://...&#39;&lt;/code&gt; when calling &lt;code&gt;mooncake.create_table&lt;/code&gt; with named arguments.&lt;/p&gt;&#xA;  &lt;/div&gt;&#xA;&lt;/div&gt;</description>
      </item>
    <item>
        <title>Query Columnstore Table &amp; Supported Query Shapes</title>
        <link>https://mooncake.pgsty.com/docs/reference/query-columnstore/</link>
        <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
        
        <guid>https://mooncake.pgsty.com/docs/reference/query-columnstore/</guid>
        <description>&lt;p&gt;Columnstore mirror tables created with &lt;code&gt;CALL mooncake.create_table(dst, src)&lt;/code&gt; are queried using standard PostgreSQL &lt;code&gt;SELECT&lt;/code&gt; syntax. Behind the scenes, &lt;code&gt;pg_mooncake&lt;/code&gt; and &lt;code&gt;pg_duckdb 1.2.0&lt;/code&gt; translate and route analytical scans to the embedded &lt;strong&gt;DuckDB &lt;code&gt;v2.0.0&lt;/code&gt;&lt;/strong&gt; vectorized execution engine.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-it-works&#34;&gt;How Queries Work&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;When you query a &lt;code&gt;USING mooncake&lt;/code&gt; table:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;LSN Synchronization&lt;/strong&gt;: &lt;code&gt;duckdb_mooncake&lt;/code&gt; checks PostgreSQL&amp;rsquo;s current WAL write LSN and waits for &lt;a href=&#34;https://mooncake.pgsty.com/docs/intro/moonlink/&#34;&gt;&lt;code&gt;moonlink&lt;/code&gt;&lt;/a&gt; to ingest all committed transactions up to that LSN.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Segment Elimination&lt;/strong&gt;: DuckDB 2.0 inspects multi-file Parquet column min/max statistics to skip files and row groups that cannot match your &lt;code&gt;WHERE&lt;/code&gt; predicates.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Zero-Copy Hybrid Scan&lt;/strong&gt;: Flushed Parquet files, Roaring Bitmap deletion vectors, and the in-memory Apache Arrow write buffer are scanned in parallel across DuckDB worker threads (&lt;code&gt;duckdb.threads&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;You can verify that DuckDB is executing your query by running &lt;code&gt;EXPLAIN&lt;/code&gt;:&lt;/p&gt;</description>
      </item>
    <item>
        <title>Apache Iceberg v2 &amp; Object Storage Configuration</title>
        <link>https://mooncake.pgsty.com/docs/reference/iceberg/</link>
        <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
        
        <guid>https://mooncake.pgsty.com/docs/reference/iceberg/</guid>
        <description>&lt;p&gt;Every columnstore mirror table in &lt;code&gt;pg_mooncake&lt;/code&gt; (&lt;code&gt;v0.3.0&lt;/code&gt;) is backed by &lt;a href=&#34;https://mooncake.pgsty.com/docs/intro/moonlink/&#34;&gt;&lt;code&gt;moonlink&lt;/code&gt;&lt;/a&gt;, which writes data as standard &lt;strong&gt;Parquet&lt;/strong&gt; files and maintains &lt;strong&gt;Apache Iceberg v2&lt;/strong&gt; table metadata.&lt;/p&gt;&#xA;&lt;p&gt;By default, Moonlink writes files to the local filesystem under &lt;code&gt;$PGDATA/pg_mooncake/&lt;/code&gt;. You can configure &lt;code&gt;pg_mooncake&lt;/code&gt; to write directly to &lt;strong&gt;Amazon S3&lt;/strong&gt;, &lt;strong&gt;Cloudflare R2&lt;/strong&gt;, &lt;strong&gt;MinIO&lt;/strong&gt;, or &lt;strong&gt;Google Cloud Storage (GCS)&lt;/strong&gt; so external engines (DuckDB, Apache Spark, Trino, Snowflake, PyIceberg) can query your PostgreSQL tables directly from object storage.&lt;/p&gt;</description>
      </item>
    <item>
        <title>Query Your Data Lake in Postgres</title>
        <link>https://mooncake.pgsty.com/docs/reference/query-data-lake/</link>
        <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
        
        <guid>https://mooncake.pgsty.com/docs/reference/query-data-lake/</guid>
        <description>&lt;p&gt;Because &lt;code&gt;pg_mooncake&lt;/code&gt; (&lt;code&gt;v0.3.0&lt;/code&gt;) embeds &lt;strong&gt;DuckDB &lt;code&gt;v2.0.0&lt;/code&gt;&lt;/strong&gt; via &lt;strong&gt;&lt;code&gt;pg_duckdb 1.2.0&lt;/code&gt;&lt;/strong&gt;, you can query external files in your data lake (local disk, S3, Cloudflare R2, GCS, HTTP, or HuggingFace &lt;code&gt;hf://&lt;/code&gt; datasets) directly from PostgreSQL without loading them into heap tables first.&lt;/p&gt;&#xA;&lt;h2 id=&#34;formats&#34;&gt;Supported External Formats&#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Apache Parquet&lt;/strong&gt; (&lt;code&gt;duckdb.read_parquet&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CSV / TSV&lt;/strong&gt; (&lt;code&gt;duckdb.read_csv&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;JSON / NDJSON&lt;/strong&gt; (&lt;code&gt;duckdb.read_json&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Apache Iceberg&lt;/strong&gt; (&lt;code&gt;duckdb.iceberg_scan&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Delta Lake&lt;/strong&gt; (&lt;code&gt;duckdb.delta_scan&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;td-callout td-callout--note&#34; role=&#34;note&#34;&gt;&#xA;  &lt;div class=&#34;td-callout__title&#34;&gt;&lt;i class=&#34;td-callout__icon fa-solid fa-circle-info&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;span class=&#34;td-callout__label&#34;&gt;&lt;code&gt;v0.2&lt;/code&gt; / &lt;code&gt;v0.3&lt;/code&gt; (&lt;code&gt;duckdb.*&lt;/code&gt;) vs Legacy &lt;code&gt;v0.1&lt;/code&gt; (&lt;code&gt;mooncake.*&lt;/code&gt;) Functions&lt;/span&gt;&lt;/div&gt;&#xA;  &lt;div class=&#34;td-callout__body&#34;&gt;&#xA;&lt;p&gt;In &lt;code&gt;pg_mooncake v0.2&lt;/code&gt; and &lt;code&gt;v0.3.0&lt;/code&gt;, external file readers are provided directly by &lt;code&gt;pg_duckdb&lt;/code&gt; (&lt;code&gt;duckdb.read_parquet&lt;/code&gt;, &lt;code&gt;duckdb.read_csv&lt;/code&gt;, &lt;code&gt;duckdb.iceberg_scan&lt;/code&gt;, &lt;code&gt;duckdb.delta_scan&lt;/code&gt;). For the legacy &lt;code&gt;v0.1&lt;/code&gt; &lt;code&gt;mooncake.read_parquet&lt;/code&gt; syntax, see &lt;a href=&#34;https://mooncake.pgsty.com/docs/v0.1/query-external-files/&#34;&gt;v0.1 Query External Files&lt;/a&gt;.&lt;/p&gt;&#xA;  &lt;/div&gt;&#xA;&lt;/div&gt;</description>
      </item>
    
  </channel>
</rss>
