Hi Folks,
I'm exploring Vertica performance, and I was surprised that a sample query in our small database ran faster *before* running the the database designer (1s and 4s respectively). I supplied a query file to the designer, but it has only one query (our little benchmark query), so maybe that confused it. I'm happy to provide any detail that might help. What I looked at so far is how the default projections that get created when I import data compare to the ones output by the designer (see #1 and #2 below).
A related question: How do I undo deploying the database designer changes? I can DROP PROJECTION on the created ones, but won't that leave the database with no super projections?
Version: Vertica Analytic Database v7.0.0-0
Thanks very much!
-- #1: Schema and default projections created by import:
CREATE TABLE public.acts_in
(
movie_id int,
actor_id int,
number_of_movies int,
acts_in_id int NOT NULL,
actor_age int,
id int
);
CREATE TABLE public.movie
(
movie_id int NOT NULL,
title varchar(100),
ml_title varchar(100),
year int,
budget int,
gross int,
action int,
comedy int,
sci_fi int,
thriller int,
drama int,
other int,
critic_rating int,
num_ratings int,
id int
);
CREATE TABLE public.user_ratings
(
users_id int,
movie_id int,
rating int,
user_ratings_id int NOT NULL,
id int
);
CREATE TABLE public.users
(
users_id int NOT NULL,
gender int,
age_range int,
occupation int,
zipcode int,
num_ratings int,
id int
);
CREATE TABLE public.actor
(
actor_id int NOT NULL,
name varchar(60),
month int,
day int,
year int,
is_female int,
id int
);
CREATE PROJECTION public.actor /*+createtype(L)*/
(
actor_id,
name,
month,
day,
year,
is_female,
id
)
AS
SELECT actor.actor_id,
actor.name,
actor.month,
actor.day,
actor.year,
actor.is_female,
actor.id
FROM public.actor
ORDER BY actor.actor_id,
actor.name,
actor.month,
actor.day,
actor.year,
actor.is_female,
actor.id
SEGMENTED BY hash(actor.actor_id, actor.month, actor.day, actor.year, actor.is_female, actor.id, actor.name) ALL NODES KSAFE 1;
CREATE PROJECTION public.movie /*+createtype(L)*/
(
movie_id,
title,
ml_title,
year,
budget,
gross,
action,
comedy,
sci_fi,
thriller,
drama,
other,
critic_rating,
num_ratings,
id
)
AS
SELECT movie.movie_id,
movie.title,
movie.ml_title,
movie.year,
movie.budget,
movie.gross,
movie.action,
movie.comedy,
movie.sci_fi,
movie.thriller,
movie.drama,
movie.other,
movie.critic_rating,
movie.num_ratings,
movie.id
FROM public.movie
ORDER BY movie.movie_id,
movie.title,
movie.ml_title,
movie.year,
movie.budget,
movie.gross,
movie.action,
movie.comedy,
movie.sci_fi,
movie.thriller,
movie.drama,
movie.other,
movie.critic_rating,
movie.num_ratings,
movie.id
SEGMENTED BY hash(movie.movie_id, movie.year, movie.budget, movie.gross, movie.action, movie.comedy, movie.sci_fi, movie.thriller, movie.drama, movie.other, movie.critic_rating, movie.num_ratings, movie.id, movie.title, movie.ml_title) ALL NODES KSAFE 1;
CREATE PROJECTION public.users /*+createtype(L)*/
(
users_id,
gender,
age_range,
occupation,
zipcode,
num_ratings,
id
)
AS
SELECT users.users_id,
users.gender,
users.age_range,
users.occupation,
users.zipcode,
users.num_ratings,
users.id
FROM public.users
ORDER BY users.users_id,
users.gender,
users.age_range,
users.occupation,
users.zipcode,
users.num_ratings,
users.id
SEGMENTED BY hash(users.users_id, users.gender, users.age_range, users.occupation, users.zipcode, users.num_ratings, users.id) ALL NODES KSAFE 1;
CREATE PROJECTION public.acts_in /*+createtype(L)*/
(
movie_id,
actor_id,
number_of_movies,
acts_in_id,
actor_age,
id
)
AS
SELECT acts_in.movie_id,
acts_in.actor_id,
acts_in.number_of_movies,
acts_in.acts_in_id,
acts_in.actor_age,
acts_in.id
FROM public.acts_in
ORDER BY acts_in.movie_id,
acts_in.actor_id,
acts_in.number_of_movies,
acts_in.acts_in_id,
acts_in.actor_age,
acts_in.id
SEGMENTED BY hash(acts_in.movie_id, acts_in.actor_id, acts_in.number_of_movies, acts_in.acts_in_id, acts_in.actor_age, acts_in.id) ALL NODES KSAFE 1;
CREATE PROJECTION public.user_ratings /*+createtype(L)*/
(
users_id,
movie_id,
rating,
user_ratings_id,
id
)
AS
SELECT user_ratings.users_id,
user_ratings.movie_id,
user_ratings.rating,
user_ratings.user_ratings_id,
user_ratings.id
FROM public.user_ratings
ORDER BY user_ratings.users_id,
user_ratings.movie_id,
user_ratings.rating,
user_ratings.user_ratings_id,
user_ratings.id
SEGMENTED BY hash(user_ratings.users_id, user_ratings.movie_id, user_ratings.rating, user_ratings.user_ratings_id, user_ratings.id) ALL NODES KSAFE 1;
SELECT MARK_DESIGN_KSAFE(1);
-- #2: Projections deployed by the database designer:
CREATE PROJECTION actor_DBD_1_rep_movielens_design /*+createtype(D)*/
(
actor_id ENCODING COMMONDELTA_COMP,
name ENCODING AUTO,
month ENCODING DELTAVAL,
day ENCODING DELTAVAL,
year ENCODING COMMONDELTA_COMP,
is_female ENCODING BLOCKDICT_COMP,
id ENCODING COMMONDELTA_COMP
)
AS
SELECT actor_id,
name,
month,
day,
year,
is_female,
id
FROM public.actor
ORDER BY actor_id
UNSEGMENTED ALL NODES;
CREATE PROJECTION acts_in_DBD_2_rep_movielens_design /*+createtype(D)*/
(
movie_id ENCODING DELTAVAL,
actor_id ENCODING COMMONDELTA_COMP,
number_of_movies ENCODING COMMONDELTA_COMP,
acts_in_id ENCODING DELTAVAL,
actor_age ENCODING COMMONDELTA_COMP,
id ENCODING DELTAVAL
)
AS
SELECT movie_id,
actor_id,
number_of_movies,
acts_in_id,
actor_age,
id
FROM public.acts_in
ORDER BY actor_id
UNSEGMENTED ALL NODES;
CREATE PROJECTION movie_DBD_3_rep_movielens_design /*+createtype(D)*/
(
movie_id ENCODING COMMONDELTA_COMP,
title ENCODING AUTO,
ml_title ENCODING AUTO,
year ENCODING COMMONDELTA_COMP,
budget ENCODING BLOCK_DICT,
gross ENCODING DELTARANGE_COMP,
action ENCODING BLOCKDICT_COMP,
comedy ENCODING BLOCKDICT_COMP,
sci_fi ENCODING BLOCKDICT_COMP,
thriller ENCODING BLOCKDICT_COMP,
drama ENCODING BLOCKDICT_COMP,
other ENCODING BLOCKDICT_COMP,
critic_rating ENCODING DELTAVAL,
num_ratings ENCODING DELTAVAL,
id ENCODING COMMONDELTA_COMP
)
AS
SELECT movie_id,
title,
ml_title,
year,
budget,
gross,
action,
comedy,
sci_fi,
thriller,
drama,
other,
critic_rating,
num_ratings,
id
FROM public.movie
ORDER BY movie_id
UNSEGMENTED ALL NODES;
CREATE PROJECTION user_ratings_DBD_4_rep_movielens_design /*+createtype(D)*/
(
users_id ENCODING DELTARANGE_COMP,
movie_id ENCODING RLE,
rating ENCODING RLE,
user_ratings_id ENCODING COMMONDELTA_COMP,
id ENCODING COMMONDELTA_COMP
)
AS
SELECT users_id,
movie_id,
rating,
user_ratings_id,
id
FROM public.user_ratings
ORDER BY movie_id,
rating,
id
UNSEGMENTED ALL NODES;
select refresh('public.actor, public.acts_in, public.movie, public.user_ratings');
select make_ahm_now();
DROP PROJECTION public.actor_b0, public.actor_b1 CASCADE;
DROP PROJECTION public.acts_in_b0, public.acts_in_b1 CASCADE;
DROP PROJECTION public.movie_b0, public.movie_b1 CASCADE;
DROP PROJECTION public.user_ratings_b0, public.user_ratings_b1 CASCADE;
CREATE PROJECTION users_DBD_5_rep_movielens_design /*+createtype(D)*/
(
users_id ENCODING DELTARANGE_COMP,
gender ENCODING RLE,
age_range ENCODING RLE,
occupation ENCODING BLOCKDICT_COMP,
zipcode ENCODING RLE,
num_ratings ENCODING BLOCKDICT_COMP,
id ENCODING DELTARANGE_COMP
)
AS
SELECT users_id,
gender,
age_range,
occupation,
zipcode,
num_ratings,
id
FROM public.users
ORDER BY gender,
age_range,
zipcode,
id
UNSEGMENTED ALL NODES;
select refresh('public.users');
select make_ahm_now();
DROP PROJECTION public.users_b0, public.users_b1 CASCADE;
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.