Handy SQL for DCB Ops

A page for developers and ops staff recording handy queries and updates

For Devs: Get a psql console in the k8s cluster by finding the pod name of one of the running psql instances and running kubectl exec PODNMAE -n dcb-dev -it -- psql

List bib record counts by source system

select h.name, c.count from ( select source_system_id id, count(*) count from bib_record group by source_system_id ) c, host_lms h where c.id = h.id;

Refresh the stats (Will improve performance on ingest and reclaim deleted space)

vacuum analyze; possibly better: vacuum (verbose, analyze, skip_locked);

Check for deleted cluster records (There should be NO clusters with no bib record where is_deleted is null)

select is_deleted, count(*) from cluster_record cr where not exists ( select br. from bib_record br where br.contributes_to = cr.id ) group by is_deleted;

Switch on a specific source for ingest

Ingest status

Useful current status info

 

Operated as a Community Resource by the Open Library Foundation