This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE events ( | |
user_id int, | |
event_id bigint, | |
event_type character varying(255), | |
event_time bigint | |
); | |
SELECT master_create_distributed_table('events', 'user_id', 'range'); |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
e1.user_id, | |
sum(view_homepage) AS viewed_homepage, | |
sum(use_demo) AS use_demo, | |
sum(enter_credit_card) AS entered_credit_card, | |
sum(submit_card_info) as submit_card_info, | |
sum(e5.see_bought_screen) as see_bought_screen | |
FROM ( | |
-- Get the first time each user viewed the homepage. | |
SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
e1.user_id, | |
sum(view_homepage) AS viewed_homepage, | |
sum(use_demo) AS use_demo, | |
sum(enter_credit_card) AS entered_credit_card, | |
sum(submit_card_info) as submit_card_info, | |
sum(e1.view_homepage) as see_bought_screen | |
FROM ( | |
-- Get the first time each user viewed the homepage. | |
SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE table_1 ( | |
col_1 int,col_2 int,col_3 int,col_4 int,col_5 int,col_6 int,col_7 int,col_8 int,col_9 int,col_10 int,col_11 int,col_12 int,col_13 int,col_14 int,col_15 int,col_16 int,col_17 int,col_18 int,col_19 int,col_20 int,col_21 int,col_22 int,col_23 int,col_24 int,col_25 int,col_26 int,col_27 int,col_28 int,col_29 int,col_30 int,col_31 int,col_32 int,col_33 int,col_34 int,col_35 int,col_36 int,col_37 int,col_38 int,col_39 int,col_40 int,col_41 int,col_42 int,col_43 int,col_44 int,col_45 int,col_46 int,col_47 int,col_48 int,col_49 int,col_50 int,col_51 int,col_52 int,col_53 int,col_54 int,col_55 int,col_56 int,col_57 int,col_58 int,col_59 int,col_60 int,col_61 int,col_62 int,col_63 int,col_64 int,col_65 int,col_66 int,col_67 int,col_68 int,col_69 int,col_70 int,col_71 int,col_72 int,col_73 int,col_74 int,col_75 int,col_76 int,col_77 int,col_78 int,col_79 int,col_80 int,col_81 int,col_82 int,col_83 int,col_84 int,col_85 int,col_86 int,col_87 int,col_88 int,col_89 int,col_90 int,col_91 int,col_92 i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- multi subquery in where queries aims to expand existing subquery pushdown | |
-- regression tests to cover more cases specifically subqueries in WHERE clause | |
-- the tables that are used depends to multi_insert_select_behavioral_analytics_create_table.sql | |
-- | |
-- We don't need shard id sequence here, so commented out to prevent conflicts with concurrent tests | |
-- ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 1430000; | |
-- ALTER SEQUENCE pg_catalog.pg_dist_jobid_seq RESTART 1430000; | |
-- subqueries in WHERE with greater operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- MULTI_VIEW | |
-- | |
-- This file contains test cases for view support. It verifies various | |
-- Citus features: simple selects, aggregates, joins, outer joins | |
-- router queries, single row inserts, multi row inserts via insert | |
-- into select, multi row insert via copy commands. | |
SELECT count(*) FROM lineitem_hash_part; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT user_id, counter | |
FROM ( | |
SELECT user_id, value_2 % 10 AS counter FROM events_table WHERE event_type IN (1, 2, 3, 4, 5) | |
UNION | |
SELECT user_id, value_2 % 10 AS counter FROM events_table WHERE event_type IN (5, 6, 7, 8, 9, 10) | |
) user_id | |
ORDER BY 2 DESC,1 | |
LIMIT 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE users | |
( | |
user_id int, | |
value int | |
); | |
CREATE TABLE events | |
( | |
user_id int, | |
value int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- create a partitioned local table | |
CREATE TABLE measurement ( | |
city_id int not null, | |
logdate date not null, | |
peaktemp int, | |
unitsales int | |
) PARTITION BY RANGE (logdate); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT *, rank() OVER (PARTITION BY solomon_user_id ORDER BY page_views DESC) | |
FROM ( | |
SELECT solomon_user_id, key, COUNT(*) AS page_views | |
FROM page_intermediates | |
GROUP BY solomon_user_id, key | |
) AS A; |