pyiron / FAQs

General question board for pyiron users
3 stars 0 forks source link

Avoid bad performance of jobs view. #38

Open XzzX opened 7 months ago

XzzX commented 7 months ago

Make sure the WHERE clause of the jobs view is using the index on username. Type and collation must match!

CREATE OR REPLACE VIEW public.jobs_cmmc
    WITH (check_option=cascaded, security_barrier=true)
    AS
     SELECT id,
    parentid,
    masterid,
    projectpath,
    project,
    job,
    subjob,
    chemicalformula,
    status,
    hamilton,
    hamversion,
    username,
    computer,
    timestart,
    timestop,
    totalcputime
   FROM jobs_cmmc_admin
  WHERE "current_user"()::text COLLATE pg_catalog."default" = username;

Also refer to
https://stackoverflow.com/questions/68497605/postgresql-not-using-index-for-queries-using-current-user/78028168#78028168