Skip to content

Instantly share code, notes, and snippets.

@schukin
schukin / read-access.sql
Created May 13, 2020 05:25 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
Timer based...
(Create a scheduled NSTimer then invalidate it)
(# of timers, total time, time per timer)
1 0.000080 0.000080
10 0.000087 0.000009
100 0.000425 0.000004
1000 0.003176 0.000003
10000 0.030586 0.000003
100000 0.302724 0.000003
1000000 3.071473 0.000003