database-partitioning

Partition pruning based on check constraint not working as expected

橙三吉。 提交于 2019-12-22 01:14:38
问题 Why is the table "events_201504" included in the query plan below? Based on my query and the check constraint on that table I would expect the query planner to be able to prune it entirely: database=# \d events_201504 Table "public.events_201504" Column | Type | Modifiers ---------------+-----------------------------+--------------------------------------------------------------- id | bigint | not null default nextval('events_id_seq'::regclass) created_at | timestamp without time zone |

mysql partitioning with unix_timestamp from variable

二次信任 提交于 2019-12-21 17:22:09
问题 Given this : delimiter // create procedure setup() begin declare d datetime; set d = rounddate(now()); create table s_time (req_id int not null, ser_id int not null, hel_id int not null, posted int unsigned not null, completed int unsigned not null default 0 ) partition by range (completed) (partition p0 values less than ( unix_timestamp(d) ), partition p1 values less than ( unix_timestamp(d + interval 1 day) ) ); end// I get : ERROR 1064 (42000) : Constant, random, or timezone-dependent

How do I create a partition for every month of the current year

三世轮回 提交于 2019-12-21 17:20:11
问题 I want to partition my data by "MONTH" I am trying this, ALTER TABLE t1 PARTITION BY RANGE(TO_DAYS(FROM_UNIXTIME(transaction_date)))( PARTITION JAN VALUES LESS THAN (TO_DAYS('2013-02-01')), PARTITION FEB VALUES LESS THAN (TO_DAYS('2013-03-01')), PARTITION MAR VALUES LESS THAN (TO_DAYS('2013-04-01')), PARTITION APR VALUES LESS THAN (TO_DAYS('2013-05-01')), PARTITION MAY VALUES LESS THAN (TO_DAYS('2013-06-01')), PARTITION JUN VALUES LESS THAN (TO_DAYS('2013-07-01')), PARTITION JUL VALUES LESS

PostgreSQL 11 foreign key on partitioning tables

北城余情 提交于 2019-12-21 12:36:51
问题 In the PostgreSQL 11 Release Notes I found the following improvements to partitioning functionality: Add support for PRIMARY KEY, FOREIGN KEY, indexes, and triggers on partitioned tables I need this feature and tested it. Create table: CREATE TABLE public.tbl_test ( uuid character varying(32) NOT null, registration_date timestamp without time zone NOT NULL ) PARTITION BY RANGE (registration_date); Try to create Primary key: ALTER TABLE public.tbl_test ADD CONSTRAINT pk_test PRIMARY KEY (uuid)

Dynamic Partitioning + CREATE AS on HIVE

落花浮王杯 提交于 2019-12-20 12:12:20
问题 I'm trying to create a new table from another table with CREATE AS and dynamic Partitioning on HiveCLI. I'm learning from Hive official wiki where there is this example: CREATE TABLE T (key int, value string) PARTITIONED BY (ds string, hr int) AS SELECT key, value, ds, hr+1 hr1 FROM srcpart WHERE ds is not null And hr>10; But I received this error: FAILED: SemanticException [Error 10065]: CREATE TABLE AS SELECT command cannot specify the list of columns for the target table Source: https:/

Dynamic Partitioning + CREATE AS on HIVE

孤者浪人 提交于 2019-12-20 12:12:05
问题 I'm trying to create a new table from another table with CREATE AS and dynamic Partitioning on HiveCLI. I'm learning from Hive official wiki where there is this example: CREATE TABLE T (key int, value string) PARTITIONED BY (ds string, hr int) AS SELECT key, value, ds, hr+1 hr1 FROM srcpart WHERE ds is not null And hr>10; But I received this error: FAILED: SemanticException [Error 10065]: CREATE TABLE AS SELECT command cannot specify the list of columns for the target table Source: https:/

Dynamic Partitioning + CREATE AS on HIVE

本秂侑毒 提交于 2019-12-20 12:11:34
问题 I'm trying to create a new table from another table with CREATE AS and dynamic Partitioning on HiveCLI. I'm learning from Hive official wiki where there is this example: CREATE TABLE T (key int, value string) PARTITIONED BY (ds string, hr int) AS SELECT key, value, ds, hr+1 hr1 FROM srcpart WHERE ds is not null And hr>10; But I received this error: FAILED: SemanticException [Error 10065]: CREATE TABLE AS SELECT command cannot specify the list of columns for the target table Source: https:/

SQL Server Partitioning - Unique Index Error

一曲冷凌霜 提交于 2019-12-19 16:54:10
问题 I have a table that is partitioned by TRANSACTION_DATE_TIME. Table has a column: ID. I want to create a unique index for ID on partition scheme as: CREATE UNIQUE NONCLUSTERED INDEX [IX_ID_ON_PS_DATETIME] ON [CRD].[TRANSACTION] ( [ID] ASC ) ON [PS_DATETIME_WEEKLY]([TRANSACTION_DATE_TIME]) but SQL says "Partition column for a unique index must be a subset of index key". I really don't need TRANSACTION_DATE_TIME column in this index. How can I create the index without using TRANSACTION_DATE_TIME

SQL Error: ORA-14006: invalid partition name

允我心安 提交于 2019-12-18 03:47:16
问题 I am trying to partition an existing table in Oracle 12C R1 using below SQL statement. ALTER TABLE TABLE_NAME MODIFY PARTITION BY RANGE (DATE_COLUMN_NAME) INTERVAL (NUMTOYMINTERVAL(1,'MONTH')) ( PARTITION part_01 VALUES LESS THAN (TO_DATE('01-SEP-2017', 'DD-MON-RRRR')) ) ONLINE; Getting error: Error report - SQL Error: ORA-14006: invalid partition name 14006. 00000 - "invalid partition name" *Cause: a partition name of the form <identifier> is expected but not present. *Action: enter an

What's a good balance to decide when to partition a table in BigQuery?

爱⌒轻易说出口 提交于 2019-12-17 20:47:31
问题 We are using a public dataset to benchmark BigQuery. We took the same table and partitioned it by day, but it's not clear we are getting many benefits. What's a good balance? SELECT sum(score) FROM `fh-bigquery.stackoverflow_archive.201906_posts_questions` WHERE creation_date > "2019-01-01" Takes 1 second, and processes 270.7MB. Same, with partitions: SELECT sum(score) FROM `temp.questions_partitioned` WHERE creation_date > "2019-01-01" Takes 2 seconds and processes 14.3 MB. So we see a