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
update host_lms set client_config = client_config || '{"ingest":true}' where code='CODE';
Ingest status
select h.id, h.code, h.client_config->'ingest', ps.process_name, ps.process_state->'cursor' from host_lms h, process_state ps where h.id = ps.context;
Useful current status info
select pr.id, pr.date_created, pr.patron_hostlms_code patron_system, pr.status_code dcb_status, pr.local_request_status pickup_request_status, pr.local_item_id borrower_item_id, pr.local_item_status borrower_item_status, pr.next_scheduled_poll next_poll, sr.local_item_status lender_item_status, sr.local_status lender_request_status from patron_request pr, supplier_request sr where sr.patron_request_id = pr.id order by date_created;