Truncate parent table but not children I have a table in PostgreSQL 9.4 that I partitioned so that all inserts to the parent actually go into one of the child partitions. The problem is that I already have hundreds of millions of rows of data in the parent table from before I created partitions.

The parent and children exist in different schemas:  

parent: public.history_uint
children: partitions.history_uint_p2015_mm_dd

Here is how I created the partitions. 

How to TRUNCATE the parent but not the children?
Use the ONLY key word:

TRUNCATE ONLY public.history_uint;

The manual:


  If ONLY is specified before the table name, only that table is
  truncated. If ONLY is not specified, the table and all its descendant
  tables (if any) are truncated. Optionally, * can be specified after
  the table name to explicitly indicate that descendant tables are included.


The schemas where parent and children live are only relevant as far as user privileges on the schema are concerned. Otherwise it's all the same to Postgres.