Use crontab DBInserts.txt to start a cron job Use crontab -l to view if jobs are qued User crontab -r to remove all jobs
Use the output log files to detect timings for write/sec
24 * * * * PGPASSWORD=postgres psql -h localhost -U postgres -d Test -f /home/ubuntu/inserts.sql >> /home/ubuntu/1.txt |
\timing on | |
CREATE SEQUENCE IF NOT EXISTS "Counter" START 1; | |
DO $$ | |
DECLARE | |
p_application_name TEXT; | |
BEGIN | |
select ('Bulk-Worker-'||pg_backend_pid()) INTO p_application_name; | |
RAISE INFO 'Setting Application Name To: %', p_application_name; | |
EXECUTE FORMAT('SET application_name = %L', p_application_name); | |
END$$; | |
INSERT INTO "Data"."Raw"("Timestamp", "Value", "Quality","TagId") | |
SELECT (TO_TIMESTAMP('2020-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS')+ ((g||' second')::interval+(ctr||' year')::interval)),g,(g-1),ctr | |
FROM (select generate_series(1, 315360000) as g,* from nextval('"Counter"') as ctr) as g; |