{"id":863,"date":"2024-12-12T16:45:38","date_gmt":"2024-12-12T09:45:38","guid":{"rendered":"https:\/\/www.pgtutorial.com\/?page_id=863"},"modified":"2025-01-03T14:35:49","modified_gmt":"2025-01-03T07:35:49","slug":"postgresql-truncate-table","status":"publish","type":"page","link":"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/","title":{"rendered":"PostgreSQL TRUNCATE TABLE Statement"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: In this tutorial, you&#8217;ll learn how to use the PostgreSQL <code>TRUNCATE TABLE<\/code> statement to quickly and efficiently remove all data from large tables.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='getting-started-with-the-postgresql-truncate-table-statement'>Getting started with the PostgreSQL TRUNCATE TABLE Statement <a href=\"#getting-started-with-the-postgresql-truncate-table-statement\" class=\"anchor\" id=\"getting-started-with-the-postgresql-truncate-table-statement\" title=\"Anchor for Getting started with the PostgreSQL TRUNCATE TABLE Statement\">#<\/a><\/h2>\n\n\n\n<p>The <code>TRUNCATE TABLE<\/code> statement allows you to remove all rows from a table. Here&#8217;s the basic syntax of the <code>TRUNCATE TABLE<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-built_in\">table_name<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax, you provide the table name you want to truncate in the <code>TRUNCATE TABLE<\/code> clause.<\/p>\n\n\n\n<p>Note that the <code>TABLE<\/code> keyword is optional, so you can make the statement shorter like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-built_in\">table_name<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='truncating-table-with-identity-columns'>Truncating Table with Identity Columns <a href=\"#truncating-table-with-identity-columns\" class=\"anchor\" id=\"truncating-table-with-identity-columns\" title=\"Anchor for Truncating Table with Identity Columns\">#<\/a><\/h3>\n\n\n\n<p>If the table you want to truncate has <a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-identity-column\/\">identity columns<\/a>, you can use the <code>RESTART IDENTITY<\/code> option to restart the values of the identity columns:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-built_in\">table_name<\/span> \n<span class=\"hljs-keyword\">RESTART<\/span> <span class=\"hljs-keyword\">IDENTITY<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example, if the value in the identity column starts at 1 with an increment of 1, you can use the <code>RESTART IDENTITY<\/code> option to restart the value back to 1.<\/p>\n\n\n\n<p>If you don&#8217;t want to restart the values of the identity columns, you can use the <code>CONTINUE IDENTITY<\/code> option:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-built_in\">table_name<\/span> \n<span class=\"hljs-keyword\">CONTINUE<\/span> <span class=\"hljs-keyword\">IDENTITY<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Since the <code>CONTINUE IDENTITY<\/code> option is the default, you can ignore it to use the continuing identity values:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-built_in\">table_name<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='truncating-table-with-foreign-key-references'>Truncating Table with Foreign Key References <a href=\"#truncating-table-with-foreign-key-references\" class=\"anchor\" id=\"truncating-table-with-foreign-key-references\" title=\"Anchor for Truncating Table with Foreign Key References\">#<\/a><\/h3>\n\n\n\n<p>If you truncate a table with <a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-foreign-key\/\">foreign key<\/a> references, you&#8217;ll get an error. Fortunately, you can use the <code>CASCADE<\/code> option to automatically truncate the table as well as its foreign key tables in one go:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-built_in\">table_name<\/span> \n<span class=\"hljs-keyword\">CASCADE<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>To reject the truncation of the foreign key tables, you can ignore the <code>CASCADE<\/code> option or explicitly use the <code>RESTRICT<\/code> option:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-built_in\">table_name<\/span> \n<span class=\"hljs-keyword\">RESTRICT<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note that the <code>RESTRICT<\/code> option is the default.<\/p>\n\n\n\n<p>If you use the <code>RESTART IDENTITY<\/code> and <code>CASCADE<\/code> options at the same time, you need to place the <code>CASCADE<\/code> option after the <code>RESTART IDENTITY<\/code> option:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> <span class=\"hljs-built_in\">table_name<\/span>\n<span class=\"hljs-keyword\">RESTART<\/span> <span class=\"hljs-keyword\">IDENTITY<\/span>\n<span class=\"hljs-keyword\">CASCADE<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='postgresql-truncate-table-statement-examples'>PostgreSQL TRUNCATE TABLE Statement Examples <a href=\"#postgresql-truncate-table-statement-examples\" class=\"anchor\" id=\"postgresql-truncate-table-statement-examples\" title=\"Anchor for PostgreSQL TRUNCATE TABLE Statement Examples\">#<\/a><\/h2>\n\n\n\n<p>We&#8217;ll use the <code>inventory<\/code> database for demonstration purposes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='truncating-one-table'>Truncating One Table <a href=\"#truncating-one-table\" class=\"anchor\" id=\"truncating-one-table\" title=\"Anchor for Truncating One Table\">#<\/a><\/h3>\n\n\n\n<p>First, use the <code>TRUNCATE TABLE<\/code> to delete all data from the <code>transactions<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> transactions;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pgtutorial.com\/playground\/?q=VFJVTkNBVEUgVEFCTEUgdHJhbnNhY3Rpb25zOw%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Second, verify the contents of the truncation by counting rows from the <code>transactions<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">SELECT<\/span> COUNT(*) <span class=\"hljs-keyword\">FROM<\/span> transactions;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pgtutorial.com\/playground\/?q=VFJVTkNBVEUgVEFCTEUgdHJhbnNhY3Rpb25zOw%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\"> count\n-------\n     0<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id='truncating-a-table-with-foreign-key-references'>Truncating a Table with Foreign Key References <a href=\"#truncating-a-table-with-foreign-key-references\" class=\"anchor\" id=\"truncating-a-table-with-foreign-key-references\" title=\"Anchor for Truncating a Table with Foreign Key References\">#<\/a><\/h3>\n\n\n\n<p>First, truncate the <code>categories<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> categories;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pgtutorial.com\/playground\/?q=VFJVTkNBVEUgVEFCTEUgY2F0ZWdvcmllczs%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Error:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">ERROR:  cannot truncate a table referenced in a foreign key constraint\nDETAIL:  Table \"products\" references \"categories\".\nHINT:  Truncate table \"products\" at the same time, or use TRUNCATE ... CASCADE.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It returns an error because a foreign key constraint in the <code>products<\/code> table references the <code>categories<\/code> table.<\/p>\n\n\n\n<p>Second, truncate the <code>categories<\/code> table with the <code>CASCADE<\/code> option:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> categories <span class=\"hljs-keyword\">CASCADE<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pgtutorial.com\/playground\/?q=VFJVTkNBVEUgVEFCTEUgY2F0ZWdvcmllcyBDQVNDQURFOw%3D%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>PostgreSQL issued the following notices:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">NOTICE:  truncate cascades to table \"products\"\nNOTICE:  truncate cascades to table \"product_tags\"\nNOTICE:  truncate cascades to table \"inventories\"\nNOTICE:  truncate cascades to table \"transactions\"<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>TRUNCATE TABLE<\/code> statement truncates the <code>products<\/code> table and has a foreign key reference to the <code>categories<\/code> table.<\/p>\n\n\n\n<p>Since the <code>products<\/code> table also has foreign key references from the other three tables, <code>product_tags<\/code>, <code>inventories<\/code>, and <code>transactions<\/code>, the <code>TRUNCATE TABLE<\/code> statement also truncates these dependent tables.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id='restarting-identity-option'>Restarting Identity Option <a href=\"#restarting-identity-option\" class=\"anchor\" id=\"restarting-identity-option\" title=\"Anchor for Restarting Identity Option\">#<\/a><\/h3>\n\n\n\n<p>The <code>brands<\/code> table has the <code>id<\/code> as the identity column. We&#8217;ll truncate this table using the default and the <code>RESTART IDENTITY<\/code> options.<\/p>\n\n\n\n<p>First, truncate the <code>brands<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-16\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> brands <span class=\"hljs-keyword\">CASCADE<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-16\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pgtutorial.com\/playground\/?q=VFJVTkNBVEUgVEFCTEUgYnJhbmRzIENBU0NBREU7\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Second, <a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-insert\/\">insert a new row<\/a> into the <code>brands<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-17\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> brands(brand_name) \n<span class=\"hljs-keyword\">VALUES<\/span>(<span class=\"hljs-string\">'Apple'<\/span>) \n<span class=\"hljs-keyword\">RETURNING<\/span> *;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-17\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pgtutorial.com\/playground\/?q=SU5TRVJUIElOVE8gYnJhbmRzKGJyYW5kX25hbWUpIFZBTFVFUygnQXBwbGUnKSBSRVRVUk5JTkcgKjs%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-18\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\"> brand_id | brand_name\n----------+------------\n       11 | Apple<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-18\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>PostgreSQL uses the next identity value, which is the default behavior.<\/p>\n\n\n\n<p>Third, truncate the brands table again with the <code>RESTART IDENTITY<\/code> option:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-19\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> brands \n<span class=\"hljs-keyword\">RESTART<\/span> <span class=\"hljs-keyword\">IDENTITY<\/span> <span class=\"hljs-keyword\">CASCADE<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-19\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pgtutorial.com\/playground\/?q=VFJVTkNBVEUgVEFCTEUgYnJhbmRzIFJFU1RBUlQgSURFTlRJVFkgQ0FTQ0FERTs%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-20\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\"> brand_id | brand_name\n----------+------------\n        1 | Apple<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-20\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Finally, <a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-insert\/\">insert a new row<\/a> into the <code>brands<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-21\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> brands(brand_name) \n<span class=\"hljs-keyword\">VALUES<\/span>(<span class=\"hljs-string\">'Apple'<\/span>) \n<span class=\"hljs-keyword\">RETURNING<\/span> *;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-21\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a href=\"https:\/\/www.pgtutorial.com\/playground\/?q=SU5TRVJUIElOVE8gYnJhbmRzKGJyYW5kX25hbWUpIFZBTFVFUygnQXBwbGUnKSBSRVRVUk5JTkcgKjs%3D\" target=\"_blank\" rel=\"noreferrer noopener\">Try it<\/a><\/p>\n\n\n\n<p>The value in the id column starts at 1.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='postgresql-truncate-table-statement-truncating-multiple-tables'>PostgreSQL TRUNCATE TABLE Statement &#8211; Truncating Multiple Tables <a href=\"#postgresql-truncate-table-statement-truncating-multiple-tables\" class=\"anchor\" id=\"postgresql-truncate-table-statement-truncating-multiple-tables\" title=\"Anchor for PostgreSQL TRUNCATE TABLE Statement - Truncating Multiple Tables\">#<\/a><\/h2>\n\n\n\n<p>You can truncate multiple tables in one go using the <code>TRUNCATE TABLE<\/code> statement:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-22\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> table1, table2, ...;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-22\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For example, the following statement truncates both <code>users<\/code> and <code>profiles<\/code> tables:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-23\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">TRUNCATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> users, profiles <span class=\"hljs-keyword\">CASCADE<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-23\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Notice<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-24\" data-shcb-language-name=\"plaintext\" data-shcb-language-slug=\"plaintext\"><span><code class=\"hljs language-plaintext\">NOTICE:  truncate cascades to table \"transactions\"<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-24\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">plaintext<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">plaintext<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Since the <code>transactions<\/code> table has a foreign key reference to the <code>users<\/code> table, the <code>TRUNCATE TABLE<\/code>  statement also truncated the <code>transactions<\/code> table.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='truncate-table-vs-delete-statement'>TRUNCATE TABLE vs. DELETE statement <a href=\"#truncate-table-vs-delete-statement\" class=\"anchor\" id=\"truncate-table-vs-delete-statement\" title=\"Anchor for TRUNCATE TABLE vs. DELETE statement\">#<\/a><\/h2>\n\n\n\n<p>The <code><a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-delete\/\">DELETE<\/a><\/code> statement without a <code><a href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-where\/\">WHERE<\/a><\/code> clause also allows you to remove all data from a table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-25\" data-shcb-language-name=\"PostgreSQL SQL dialect and PL\/pgSQL\" data-shcb-language-slug=\"pgsql\"><span><code class=\"hljs language-pgsql\"><span class=\"hljs-keyword\">DELETE<\/span> <span class=\"hljs-keyword\">FROM<\/span> <span class=\"hljs-built_in\">table_name<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-25\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PostgreSQL SQL dialect and PL\/pgSQL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">pgsql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>When the table has a lot of data, the <code>DELETE<\/code> statement is not efficient for the following reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Row-by-row deletion:<\/strong> The <code>DELETE<\/code> statement needs to delete each row individually. For each row, it needs to check constraints and update the indexes, which can be slow if the table has lot of rows.<\/li>\n\n\n\n<li><strong>Transaction logging:<\/strong> The <code>DELETE<\/code> statement logs each row in the transaction log to support rollback operations. This logging may create significant overhead when deleting a large number of rows.<\/li>\n\n\n\n<li><strong>Locking:<\/strong> The <code>DELETE<\/code> statement acquires row-level locks, which causes performance bottlenecks.<\/li>\n<\/ul>\n\n\n\n<p>The <code>TRUNCATE TABLE<\/code> statement addresses these issues by:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Faster operation<\/strong>: The <code>TRUNCATE TABLE<\/code> statement removes all rows by deallocating the data pages, which is faster than removing rows one by one.<\/li>\n\n\n\n<li><strong>Minimal logging<\/strong>: The <code>TRUNCATE TABLE<\/code> statement generates minimal transaction log data compared to the <code>DELETE<\/code> statement, reducing logging overhead.<\/li>\n\n\n\n<li><strong>No row-level locks<\/strong>: The <code>TRUNCATE TABLE<\/code> statement can perform faster because it does not acquire row-level locks.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the PostgreSQL <code>TRUNCATE TABLE<\/code> statement to delete all rows from large tables quickly and efficiently.<\/li>\n\n\n\n<li>Use the <code>CASCADE<\/code> option to truncate cascade to tables with foreign key references to the table you want to truncate.<\/li>\n\n\n\n<li>Use the <code>RESTART IDENTITY<\/code> option to restart the values in the identity column.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id='quiz'>Quiz <a href=\"#quiz\" class=\"anchor\" id=\"quiz\" title=\"Anchor for Quiz\">#<\/a><\/h2>\n\n\n\n<iframe loading=\"lazy\"\n  name=\"quiz\"\n  src=\"\/quiz\/?quiz=truncate-table\"\n  height=\"700\"\n  width=\"600\"\n  class=\"iframe\"\n><\/iframe>\n\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"863\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/\"\n\t\t\t\tdata-post-title=\"PostgreSQL TRUNCATE TABLE Statement\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"863\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/\"\n\t\t\t\tdata-post-title=\"PostgreSQL TRUNCATE TABLE Statement\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summary: In this tutorial, you&#8217;ll learn how to use the PostgreSQL TRUNCATE TABLE statement to quickly and efficiently remove all data from large tables. Getting started with the PostgreSQL TRUNCATE TABLE Statement # The TRUNCATE TABLE statement allows you to remove all rows from a table. Here&#8217;s the basic syntax of the TRUNCATE TABLE statement: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":13,"menu_order":73,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-863","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PostgreSQL TRUNCATE TABLE Statement<\/title>\n<meta name=\"description\" content=\"You&#039;ll learn how to use the PostgreSQL TRUNCATE TABLE statement to quickly and efficiently remove all data from large tables.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PostgreSQL TRUNCATE TABLE Statement\" \/>\n<meta property=\"og:description\" content=\"You&#039;ll learn how to use the PostgreSQL TRUNCATE TABLE statement to quickly and efficiently remove all data from large tables.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/\" \/>\n<meta property=\"og:site_name\" content=\"PostgreSQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-03T07:35:49+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-tutorial\\\/postgresql-truncate-table\\\/\",\"url\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-tutorial\\\/postgresql-truncate-table\\\/\",\"name\":\"PostgreSQL TRUNCATE TABLE Statement\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/#website\"},\"datePublished\":\"2024-12-12T09:45:38+00:00\",\"dateModified\":\"2025-01-03T07:35:49+00:00\",\"description\":\"You'll learn how to use the PostgreSQL TRUNCATE TABLE statement to quickly and efficiently remove all data from large tables.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-tutorial\\\/postgresql-truncate-table\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-tutorial\\\/postgresql-truncate-table\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/postgresql-tutorial\\\/postgresql-truncate-table\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pgtutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PostgreSQL Tutorial\",\"item\":\"https:\\\/\\\/www.pgtutorial.com\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PostgreSQL TRUNCATE TABLE Statement\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pgtutorial.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pgtutorial.com\\\/\",\"name\":\"PostgreSQL Tutorial\",\"description\":\"Learn PostgreSQL from Scratch\",\"alternateName\":\"PostgreSQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pgtutorial.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PostgreSQL TRUNCATE TABLE Statement","description":"You'll learn how to use the PostgreSQL TRUNCATE TABLE statement to quickly and efficiently remove all data from large tables.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/","og_locale":"en_US","og_type":"article","og_title":"PostgreSQL TRUNCATE TABLE Statement","og_description":"You'll learn how to use the PostgreSQL TRUNCATE TABLE statement to quickly and efficiently remove all data from large tables.","og_url":"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/","og_site_name":"PostgreSQL Tutorial","article_modified_time":"2025-01-03T07:35:49+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/","url":"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/","name":"PostgreSQL TRUNCATE TABLE Statement","isPartOf":{"@id":"https:\/\/www.pgtutorial.com\/#website"},"datePublished":"2024-12-12T09:45:38+00:00","dateModified":"2025-01-03T07:35:49+00:00","description":"You'll learn how to use the PostgreSQL TRUNCATE TABLE statement to quickly and efficiently remove all data from large tables.","breadcrumb":{"@id":"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pgtutorial.com\/postgresql-tutorial\/postgresql-truncate-table\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pgtutorial.com\/"},{"@type":"ListItem","position":2,"name":"PostgreSQL Tutorial","item":"https:\/\/www.pgtutorial.com\/"},{"@type":"ListItem","position":3,"name":"PostgreSQL TRUNCATE TABLE Statement"}]},{"@type":"WebSite","@id":"https:\/\/www.pgtutorial.com\/#website","url":"https:\/\/www.pgtutorial.com\/","name":"PostgreSQL Tutorial","description":"Learn PostgreSQL from Scratch","alternateName":"PostgreSQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pgtutorial.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/comments?post=863"}],"version-history":[{"count":8,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/863\/revisions"}],"predecessor-version":[{"id":1403,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/863\/revisions\/1403"}],"up":[{"embeddable":true,"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/pages\/13"}],"wp:attachment":[{"href":"https:\/\/www.pgtutorial.com\/wp-json\/wp\/v2\/media?parent=863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}