Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
478 changes: 476 additions & 2 deletions README.md

Large diffs are not rendered by default.

439 changes: 439 additions & 0 deletions ddl_script.sql

Large diffs are not rendered by default.

Binary file added img/fifth_query_100k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fifth_query_100k_after_optimization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fifth_query_10k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fifth_query_10k_after_optimization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/first_query_100k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/first_query_100k_after_optimization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/first_query_100k_after_partition.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/first_query_10k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/first_query_10k_after_optimization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/first_query_10k_after_partition.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fourth_query_100k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fourth_query_100k_after_optoimization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fourth_query_100k_after_partition.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fourth_query_10k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fourth_query_10k_after_optoimization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/fourth_query_10k_after_partition.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/second_query_100k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/second_query_100k_optimization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/second_query_10k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/second_query_10k_after_optimization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sixth_query_100k.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/sixth_query_100k_after_creation_index.jpg
Binary file added img/sixth_query_100k_after_creation_parition.jpg
Binary file added img/sixth_query_10k.jpg
Binary file added img/sixth_query_10k_after_creation_index.jpg
Binary file added img/sixth_query_10k_after_creation_parition.jpg
Binary file added img/thrid_squery_100k.jpg
Binary file added img/thrid_squery_100k_after_optimization.jpg
Binary file added img/thrid_squery_10k.jpg
Binary file added img/thrid_squery_10k_after_optimization.jpg
Binary file added img/top_15_most_bigger_objects_for_100k.jpg
Binary file added img/top_15_most_bigger_objects_for_10k.jpg
Binary file added img/top_5_least_frequently_indexes_for_100k.jpg
Binary file added img/top_5_least_frequently_indexes_for_10k.jpg
33 changes: 33 additions & 0 deletions one_hundred_thousand.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
DO $$
DECLARE var_order_status order_status; -- order_status это кастомный тип данных
BEGIN

FOR index IN 31..100000 LOOP
IF floor(random() * (2-1+1) + 1) = 1 THEN
var_order_status := 'PAID';
ELSE
var_order_status := 'RESERVED';
END IF;
INSERT INTO film (film_id, name, duration, age_limit)
VALUES (index, concat('Ёлки ', index), trunc(random() * 98 + 52), trunc(random() * 21));

INSERT INTO session (session_id, cinema_hall_id, film_id, session_datetime)
VALUES (index, 1, index, NOW() + (random() * (NOW() + '90 days' - NOW())));

INSERT INTO seat (seat_id, row, place, cinema_hall_id)
VALUES (index, trunc(random() * 3 + 1), trunc(random() * 4 + 1), floor(random() * (2-1+1) + 1));

INSERT INTO ticket (ticket_id, session_id, seat_id, purchase_timestamp)
VALUES (index, index, index, NOW() + (random() * (NOW() + '90 days' - NOW())));

INSERT INTO client (client_id, email)
VALUES (index, concat(index,'somemail@mail.ru'));

INSERT INTO "order" (order_id, client_id, status)
VALUES (index, index, var_order_status);

INSERT INTO order_to_ticket (id, order_id, ticket_id)
VALUES (index, index, index);
END LOOP;
END;
$$;
33 changes: 33 additions & 0 deletions ten_thousand.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
DO $$
DECLARE var_order_status order_status; -- order_status это кастомный тип данных
BEGIN

FOR index IN 31..10000 LOOP
IF floor(random() * (2-1+1) + 1) = 1 THEN
var_order_status := 'PAID';
ELSE
var_order_status := 'RESERVED';
END IF;
INSERT INTO film (film_id, name, duration, age_limit)
VALUES (index, concat('Ёлки ', index), trunc(random() * 98 + 52), trunc(random() * 21));

INSERT INTO session (session_id, cinema_hall_id, film_id, session_datetime)
VALUES (index, 1, index, NOW() + (random() * (NOW() + '90 days' - NOW())));

INSERT INTO seat (seat_id, row, place, cinema_hall_id)
VALUES (index, trunc(random() * 3 + 1), trunc(random() * 4 + 1), floor(random() * (2-1+1) + 1));

INSERT INTO ticket (ticket_id, session_id, seat_id, purchase_timestamp)
VALUES (index, index, index, NOW() + (random() * (NOW() + '90 days' - NOW())));

INSERT INTO client (client_id, email)
VALUES (index, concat(index,'somemail@mail.ru'));

INSERT INTO "order" (order_id, client_id, status)
VALUES (index, index, var_order_status);

INSERT INTO order_to_ticket (id, order_id, ticket_id)
VALUES (index, index, index);
END LOOP;
END;
$$;