final performance tests as do block to measure total time

This commit is contained in:
Michael Hoennig 2022-07-26 13:18:03 +02:00
parent 04a3438182
commit 46c5f5e53e

View File

@ -1,93 +1,80 @@
DO LANGUAGE plpgsql $$
BEGIN
-- hostmaster listing all customers -- hostmaster accessing a single customer
ROLLBACK; SET SESSION SESSION AUTHORIZATION restricted;
BEGIN TRANSACTION; SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
SET SESSION SESSION AUTHORIZATION restricted; PERFORM * from customer_rv c where c.prefix='aab';
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
SET LOCAL hsadminng.assumedRoles = '';
SELECT * FROM customer_rv;
END TRANSACTION;
-- customer admin listing all their packages -- hostmaster listing all customers
ROLLBACK; SET SESSION SESSION AUTHORIZATION restricted;
BEGIN TRANSACTION; SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
SET SESSION SESSION AUTHORIZATION restricted; SET LOCAL hsadminng.assumedRoles = '';
SET LOCAL hsadminng.currentUser = 'admin@aae.example.com'; PERFORM * FROM customer_rv;
SET LOCAL hsadminng.assumedRoles = '';
SELECT * FROM package_rv;
END TRANSACTION;
-- customer admin listing all their packages
SET SESSION SESSION AUTHORIZATION restricted;
SET LOCAL hsadminng.currentUser = 'admin@aae.example.com';
SET LOCAL hsadminng.assumedRoles = '';
PERFORM * FROM package_rv;
-- cutomer admin listing all their unix users -- cutomer admin listing all their unix users
ROLLBACK; SET SESSION SESSION AUTHORIZATION restricted;
BEGIN TRANSACTION; SET LOCAL hsadminng.currentUser = 'admin@aae.example.com';
SET SESSION SESSION AUTHORIZATION restricted; SET LOCAL hsadminng.assumedRoles = '';
SET LOCAL hsadminng.currentUser = 'admin@aae.example.com'; PERFORM * FROM unixuser_rv;
SET LOCAL hsadminng.assumedRoles = '';
SELECT * FROM unixuser_rv; -- hostsharing admin assuming customer role and listing all accessible packages
END TRANSACTION; SET SESSION SESSION AUTHORIZATION restricted;
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
SET LOCAL hsadminng.assumedRoles = 'customer#aaa.admin;customer#aab.admin';
PERFORM * FROM package_rv p;
-- hostsharing admin assuming two customer admin roles and listing all accessible unixusers
-- hostsharing admin assuming customer role and listing all accessible packages SET SESSION SESSION AUTHORIZATION restricted;
ROLLBACK; SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
BEGIN TRANSACTION; SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin';
SET SESSION SESSION AUTHORIZATION restricted; PERFORM c.prefix, c.reference, uu.*
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net'; FROM unixuser_rv uu
SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin';
SELECT * FROM package_rv p;
END TRANSACTION;
---
-- hostsharing admin assuming two customer admin role and listing all accessible unixusers
ROLLBACK;
BEGIN TRANSACTION;
SET SESSION SESSION AUTHORIZATION restricted;
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin';
SELECT c.prefix, c.reference, uu.*
FROM unixuser_rv uu
JOIN package_rv p ON p.uuid = uu.packageuuid JOIN package_rv p ON p.uuid = uu.packageuuid
JOIN customer_rv c ON c.uuid = p.customeruuid; JOIN customer_rv c ON c.uuid = p.customeruuid;
END TRANSACTION;
--- -- hostsharing admin assuming two customer admin roles and listing all accessible domains
SET SESSION SESSION AUTHORIZATION restricted;
BEGIN TRANSACTION; SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
SET SESSION SESSION AUTHORIZATION restricted; SET LOCAL hsadminng.assumedRoles = 'customer#aac.admin;customer#aad.admin';
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net'; PERFORM p.name, uu.name, dom.name
SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin'; FROM domain_rv dom
SELECT p.name, uu.name, dom.name
FROM domain_rv dom
JOIN unixuser_rv uu ON uu.uuid = dom.unixuseruuid JOIN unixuser_rv uu ON uu.uuid = dom.unixuseruuid
JOIN package_rv p ON p.uuid = uu.packageuuid JOIN package_rv p ON p.uuid = uu.packageuuid
JOIN customer_rv c ON c.uuid = p.customeruuid; JOIN customer_rv c ON c.uuid = p.customeruuid;
END TRANSACTION;
--- -- hostsharing admin assuming two customer admin roles and listing all accessible email addresses
SET SESSION SESSION AUTHORIZATION restricted;
BEGIN TRANSACTION; SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
SET SESSION SESSION AUTHORIZATION restricted; SET LOCAL hsadminng.assumedRoles = 'customer#aad.admin;customer#aae.admin';
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net'; PERFORM c.prefix, p.name as "package", ema.localPart || '@' || dom.name as "email-address"
SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin';
SELECT c.prefix, p.name as "package", ema.localPart || '@' || dom.name as "email-address"
FROM emailaddress_rv ema FROM emailaddress_rv ema
JOIN domain_rv dom ON dom.uuid = ema.domainuuid JOIN domain_rv dom ON dom.uuid = ema.domainuuid
JOIN unixuser_rv uu ON uu.uuid = dom.unixuseruuid JOIN unixuser_rv uu ON uu.uuid = dom.unixuseruuid
JOIN package_rv p ON p.uuid = uu.packageuuid JOIN package_rv p ON p.uuid = uu.packageuuid
JOIN customer_rv c ON c.uuid = p.customeruuid; JOIN customer_rv c ON c.uuid = p.customeruuid;
END TRANSACTION; END; $$;
--- /*
=== with 7000 customers ===
ROLLBACK; 1. [2022-07-26 09:17:19] completed in 801 ms
BEGIN TRANSACTION; 2. [2022-07-26 09:17:32] completed in 649 ms
SET SESSION SESSION AUTHORIZATION restricted; 3. [2022-07-26 09:17:51] completed in 670 ms
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
select * from customer_rv c where c.prefix='aab'; no count required factor table
END TRANSACTION; 1 7 000 7 000 1.000 customers
2 17 436 15 000 1.162 packages
3 174 360 150 000 1.162 unixuser
4 105 206 100 000 1.052 domain
5 526 030 500 000 1.052 emailaddress
*/