Discussion:
STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?
Stephen Froehlich
2018-01-19 05:23:26 UTC
Permalink
I use a CREATE TABLE ... LIKE [default_table] (INCLUDING ALL) query to create partitions of a hypertable, and I have found that I need to add a "CREATE STATISTICS" entry between two columns of the table.

Are custom statistics in PG10 retained in LIKE (INCLUDING ALL) or do I need to recreate the statistics by hand each time I create a new table?

Thanks,
Stephen

Stephen Froehlich
Sr. Strategist, CableLabs(r)

***@cablelabs.com
Tel: +1 (303) 661-3708
Tom Lane
2018-01-20 05:50:19 UTC
Permalink
Post by Stephen Froehlich
Are custom statistics in PG10 retained in LIKE (INCLUDING ALL) or do I need to recreate the statistics by hand each time I create a new table?
LIKE doesn't know about those, no. Perhaps it should.

regards, tom lane
David Rowley
2018-01-21 06:21:52 UTC
Permalink
Post by Tom Lane
Post by Stephen Froehlich
Are custom statistics in PG10 retained in LIKE (INCLUDING ALL) or do I need to recreate the statistics by hand each time I create a new table?
LIKE doesn't know about those, no. Perhaps it should.
Agreed. ALL does not mean MOST.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Stephen Froehlich
2018-01-21 15:47:35 UTC
Permalink
Lol ... However sometimes, especially with an obscure new feature, it does :).

-----Original Message-----
From: David Rowley [mailto:***@2ndquadrant.com]
Sent: Saturday, January 20, 2018 11:22 PM
To: Tom Lane <***@sss.pgh.pa.us>
Cc: Stephen Froehlich <***@cablelabs.com>; pgsql-***@postgresql.org
Subject: Re: STATISTICS retained in CREATE TABLE ... LIKE (INCLUDING ALL)?
Post by Tom Lane
Post by Stephen Froehlich
Are custom statistics in PG10 retained in LIKE (INCLUDING ALL) or do I need to recreate the statistics by hand each time I create a new table?
LIKE doesn't know about those, no. Perhaps it should.
Agreed. ALL does not mean MOST.


--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Dev

Loading...