final performance tests as do block to measure total time
This commit is contained in:
parent
04a3438182
commit
46c5f5e53e
@ -1,93 +1,80 @@
|
|||||||
|
|
||||||
|
DO LANGUAGE plpgsql $$
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
-- hostmaster accessing a single customer
|
||||||
|
SET SESSION SESSION AUTHORIZATION restricted;
|
||||||
|
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
||||||
|
PERFORM * from customer_rv c where c.prefix='aab';
|
||||||
|
|
||||||
-- hostmaster listing all customers
|
-- hostmaster listing all customers
|
||||||
ROLLBACK;
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
SET SESSION SESSION AUTHORIZATION restricted;
|
SET SESSION SESSION AUTHORIZATION restricted;
|
||||||
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
||||||
SET LOCAL hsadminng.assumedRoles = '';
|
SET LOCAL hsadminng.assumedRoles = '';
|
||||||
SELECT * FROM customer_rv;
|
PERFORM * FROM customer_rv;
|
||||||
END TRANSACTION;
|
|
||||||
|
|
||||||
-- customer admin listing all their packages
|
-- customer admin listing all their packages
|
||||||
ROLLBACK;
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
SET SESSION SESSION AUTHORIZATION restricted;
|
SET SESSION SESSION AUTHORIZATION restricted;
|
||||||
SET LOCAL hsadminng.currentUser = 'admin@aae.example.com';
|
SET LOCAL hsadminng.currentUser = 'admin@aae.example.com';
|
||||||
SET LOCAL hsadminng.assumedRoles = '';
|
SET LOCAL hsadminng.assumedRoles = '';
|
||||||
SELECT * FROM package_rv;
|
PERFORM * FROM package_rv;
|
||||||
END TRANSACTION;
|
|
||||||
|
|
||||||
|
|
||||||
-- cutomer admin listing all their unix users
|
-- cutomer admin listing all their unix users
|
||||||
ROLLBACK;
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
SET SESSION SESSION AUTHORIZATION restricted;
|
SET SESSION SESSION AUTHORIZATION restricted;
|
||||||
SET LOCAL hsadminng.currentUser = 'admin@aae.example.com';
|
SET LOCAL hsadminng.currentUser = 'admin@aae.example.com';
|
||||||
SET LOCAL hsadminng.assumedRoles = '';
|
SET LOCAL hsadminng.assumedRoles = '';
|
||||||
|
PERFORM * FROM unixuser_rv;
|
||||||
SELECT * FROM unixuser_rv;
|
|
||||||
END TRANSACTION;
|
|
||||||
|
|
||||||
|
|
||||||
-- hostsharing admin assuming customer role and listing all accessible packages
|
-- hostsharing admin assuming customer role and listing all accessible packages
|
||||||
ROLLBACK;
|
SET SESSION SESSION AUTHORIZATION restricted;
|
||||||
BEGIN TRANSACTION;
|
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
|
||||||
SET SESSION SESSION AUTHORIZATION restricted;
|
SET SESSION SESSION AUTHORIZATION restricted;
|
||||||
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
||||||
SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin';
|
SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin';
|
||||||
SELECT * FROM package_rv p;
|
PERFORM c.prefix, c.reference, uu.*
|
||||||
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
|
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
|
||||||
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
SET SESSION SESSION AUTHORIZATION restricted;
|
SET SESSION SESSION AUTHORIZATION restricted;
|
||||||
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
||||||
SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin';
|
SET LOCAL hsadminng.assumedRoles = 'customer#aac.admin;customer#aad.admin';
|
||||||
|
PERFORM p.name, uu.name, dom.name
|
||||||
SELECT p.name, uu.name, dom.name
|
|
||||||
FROM domain_rv dom
|
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
|
||||||
|
|
||||||
BEGIN TRANSACTION;
|
|
||||||
SET SESSION SESSION AUTHORIZATION restricted;
|
SET SESSION SESSION AUTHORIZATION restricted;
|
||||||
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
SET LOCAL hsadminng.currentUser = 'mike@hostsharing.net';
|
||||||
SET LOCAL hsadminng.assumedRoles = 'customer#aab.admin;customer#aac.admin';
|
SET LOCAL hsadminng.assumedRoles = 'customer#aad.admin;customer#aae.admin';
|
||||||
|
PERFORM c.prefix, p.name as "package", ema.localPart || '@' || dom.name as "email-address"
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user