You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From PGBadger most time consuming queries report, Schedule A query is taking more than 10 sec to execute. Below are two examples of the actual Schedule A query.
Completion Criteria:
Refactor the SQL to use only the calculated columns.
Example 1:
SELECT
disclosure.fec_fitem_sched_a.cmte_id AS disclosure_fec_fitem_sched_a_cmte_id,
disclosure.fec_fitem_sched_a.rpt_yr AS disclosure_fec_fitem_sched_a_rpt_yr,
disclosure.fec_fitem_sched_a.rpt_tp AS disclosure_fec_fitem_sched_a_rpt_tp,
disclosure.fec_fitem_sched_a.image_num AS disclosure_fec_fitem_sched_a_image_num,
disclosure.fec_fitem_sched_a.line_num AS disclosure_fec_fitem_sched_a_line_num,
disclosure.fec_fitem_sched_a.tran_id AS disclosure_fec_fitem_sched_a_tran_id,
disclosure.fec_fitem_sched_a.file_num AS disclosure_fec_fitem_sched_a_file_num,
disclosure.fec_fitem_sched_a.cmte_nm AS disclosure_fec_fitem_sched_a_cmte_nm,
disclosure.fec_fitem_sched_a.entity_tp AS disclosure_fec_fitem_sched_a_entity_tp,
disclosure.fec_fitem_sched_a.entity_tp_desc AS disclosure_fec_fitem_sched_a_entity_tp_desc,
disclosure.fec_fitem_sched_a.contbr_id AS disclosure_fec_fitem_sched_a_contbr_id,
disclosure.fec_fitem_sched_a.contbr_prefix AS disclosure_fec_fitem_sched_a_contbr_prefix,
disclosure.fec_fitem_sched_a.contbr_nm AS disclosure_fec_fitem_sched_a_contbr_nm,
disclosure.fec_fitem_sched_a.contbr_nm_first AS disclosure_fec_fitem_sched_a_contbr_nm_first,
disclosure.fec_fitem_sched_a.contbr_m_nm AS disclosure_fec_fitem_sched_a_contbr_m_nm,
disclosure.fec_fitem_sched_a.contbr_nm_last AS disclosure_fec_fitem_sched_a_contbr_nm_last,
disclosure.fec_fitem_sched_a.contbr_suffix AS disclosure_fec_fitem_sched_a_contbr_suffix,
disclosure.fec_fitem_sched_a.contbr_st1 AS disclosure_fec_fitem_sched_a_contbr_st1,
disclosure.fec_fitem_sched_a.contbr_st2 AS disclosure_fec_fitem_sched_a_contbr_st2,
disclosure.fec_fitem_sched_a.contbr_city AS disclosure_fec_fitem_sched_a_contbr_city,
disclosure.fec_fitem_sched_a.contbr_st AS disclosure_fec_fitem_sched_a_contbr_st,
disclosure.fec_fitem_sched_a.contbr_zip AS disclosure_fec_fitem_sched_a_contbr_zip,
disclosure.fec_fitem_sched_a.contbr_employer AS disclosure_fec_fitem_sched_a_contbr_employer,
disclosure.fec_fitem_sched_a.contbr_occupation AS disclosure_fec_fitem_sched_a_contbr_occupation,
disclosure.fec_fitem_sched_a.clean_contbr_id AS disclosure_fec_fitem_sched_a_clean_contbr_id,
disclosure.fec_fitem_sched_a.receipt_tp AS disclosure_fec_fitem_sched_a_receipt_tp,
disclosure.fec_fitem_sched_a.receipt_tp_desc AS disclosure_fec_fitem_sched_a_receipt_tp_desc,
disclosure.fec_fitem_sched_a.receipt_desc AS disclosure_fec_fitem_sched_a_receipt_desc,
disclosure.fec_fitem_sched_a.memo_cd AS disclosure_fec_fitem_sched_a_memo_cd,
disclosure.fec_fitem_sched_a.memo_cd_desc AS disclosure_fec_fitem_sched_a_memo_cd_desc,
disclosure.fec_fitem_sched_a.contb_receipt_dt AS disclosure_fec_fitem_sched_a_contb_receipt_dt,
disclosure.fec_fitem_sched_a.contb_receipt_amt AS disclosure_fec_fitem_sched_a_contb_receipt_amt,
disclosure.fec_fitem_sched_a.contb_aggregate_ytd AS disclosure_fec_fitem_sched_a_contb_aggregate_ytd,
disclosure.fec_fitem_sched_a.cand_id AS disclosure_fec_fitem_sched_a_cand_id,
disclosure.fec_fitem_sched_a.cand_nm AS disclosure_fec_fitem_sched_a_cand_nm,
disclosure.fec_fitem_sched_a.cand_nm_first AS disclosure_fec_fitem_sched_a_cand_nm_first,
disclosure.fec_fitem_sched_a.cand_nm_last AS disclosure_fec_fitem_sched_a_cand_nm_last,
disclosure.fec_fitem_sched_a.cand_m_nm AS disclosure_fec_fitem_sched_a_cand_m_nm,
disclosure.fec_fitem_sched_a.cand_prefix AS disclosure_fec_fitem_sched_a_cand_prefix,
disclosure.fec_fitem_sched_a.cand_suffix AS disclosure_fec_fitem_sched_a_cand_suffix,
disclosure.fec_fitem_sched_a.cand_office AS disclosure_fec_fitem_sched_a_cand_office,
disclosure.fec_fitem_sched_a.cand_office_desc AS disclosure_fec_fitem_sched_a_cand_office_desc,
disclosure.fec_fitem_sched_a.cand_office_st AS disclosure_fec_fitem_sched_a_cand_office_st,
disclosure.fec_fitem_sched_a.cand_office_st_desc AS disclosure_fec_fitem_sched_a_cand_office_st_desc,
disclosure.fec_fitem_sched_a.cand_office_district AS disclosure_fec_fitem_sched_a_cand_office_district,
disclosure.fec_fitem_sched_a.conduit_cmte_id AS disclosure_fec_fitem_sched_a_conduit_cmte_id,
disclosure.fec_fitem_sched_a.conduit_cmte_nm AS disclosure_fec_fitem_sched_a_conduit_cmte_nm,
disclosure.fec_fitem_sched_a.conduit_cmte_st1 AS disclosure_fec_fitem_sched_a_conduit_cmte_st1,
disclosure.fec_fitem_sched_a.conduit_cmte_st2 AS disclosure_fec_fitem_sched_a_conduit_cmte_st2,
disclosure.fec_fitem_sched_a.conduit_cmte_city AS disclosure_fec_fitem_sched_a_conduit_cmte_city,
disclosure.fec_fitem_sched_a.conduit_cmte_st AS disclosure_fec_fitem_sched_a_conduit_cmte_st,
disclosure.fec_fitem_sched_a.conduit_cmte_zip AS disclosure_fec_fitem_sched_a_conduit_cmte_zip,
disclosure.fec_fitem_sched_a.donor_cmte_nm AS disclosure_fec_fitem_sched_a_donor_cmte_nm,
disclosure.fec_fitem_sched_a.national_cmte_nonfed_acct AS disclosure_fec_fitem_sched_a_national_cmte_nonfed_acct,
disclosure.fec_fitem_sched_a.election_tp AS disclosure_fec_fitem_sched_a_election_tp,
disclosure.fec_fitem_sched_a.election_tp_desc AS disclosure_fec_fitem_sched_a_election_tp_desc,
disclosure.fec_fitem_sched_a.fec_election_tp_desc AS disclosure_fec_fitem_sched_a_fec_election_tp_desc,
disclosure.fec_fitem_sched_a.fec_election_yr AS disclosure_fec_fitem_sched_a_fec_election_yr,
disclosure.fec_fitem_sched_a.action_cd AS disclosure_fec_fitem_sched_a_action_cd,
disclosure.fec_fitem_sched_a.action_cd_desc AS disclosure_fec_fitem_sched_a_action_cd_desc,
disclosure.fec_fitem_sched_a.schedule_type_desc AS disclosure_fec_fitem_sched_a_schedule_type_desc,
disclosure.fec_fitem_sched_a.pg_date AS disclosure_fec_fitem_sched_a_pg_date,
disclosure.fec_fitem_sched_a.orig_sub_id AS disclosure_fec_fitem_sched_a_orig_sub_id,
disclosure.fec_fitem_sched_a.back_ref_tran_id AS disclosure_fec_fitem_sched_a_back_ref_tran_id,
disclosure.fec_fitem_sched_a.back_ref_sched_nm AS disclosure_fec_fitem_sched_a_back_ref_sched_nm,
disclosure.fec_fitem_sched_a.filing_form AS disclosure_fec_fitem_sched_a_filing_form,
disclosure.fec_fitem_sched_a.link_id AS disclosure_fec_fitem_sched_a_link_id,
disclosure.fec_fitem_sched_a.contributor_name_text AS disclosure_fec_fitem_sched_a_contributor_name_text,
disclosure.fec_fitem_sched_a.contributor_employer_text AS disclosure_fec_fitem_sched_a_contributor_employer_text,
disclosure.fec_fitem_sched_a.contributor_occupation_text AS disclosure_fec_fitem_sched_a_contributor_occupation_text,
disclosure.fec_fitem_sched_a.is_individual AS disclosure_fec_fitem_sched_a_is_individual,
disclosure.fec_fitem_sched_a.memo_text AS disclosure_fec_fitem_sched_a_memo_text,
disclosure.fec_fitem_sched_a.two_year_transaction_period AS disclosure_fec_fitem_sched_a_two_year_transaction_period,
disclosure.fec_fitem_sched_a.schedule_type AS disclosure_fec_fitem_sched_a_schedule_type,
disclosure.fec_fitem_sched_a.increased_limit AS disclosure_fec_fitem_sched_a_increased_limit,
disclosure.fec_fitem_sched_a.sub_id AS disclosure_fec_fitem_sched_a_sub_id,
disclosure.fec_fitem_sched_a.pdf_url AS disclosure_fec_fitem_sched_a_pdf_url,
disclosure.fec_fitem_sched_a.line_number_label AS disclosure_fec_fitem_sched_a_line_number_label,
ofec_committee_history_mv_1.idx AS ofec_committee_history_mv_1_idx,
ofec_committee_history_mv_1.name AS ofec_committee_history_mv_1_name,
ofec_committee_history_mv_1.committee_id AS ofec_committee_history_mv_1_committee_id,
ofec_committee_history_mv_1.cycles AS ofec_committee_history_mv_1_cycles,
ofec_committee_history_mv_1.treasurer_name AS ofec_committee_history_mv_1_treasurer_name,
ofec_committee_history_mv_1.treasurer_text AS ofec_committee_history_mv_1_treasurer_text,
ofec_committee_history_mv_1.committee_type AS ofec_committee_history_mv_1_committee_type,
ofec_committee_history_mv_1.committee_type_full AS ofec_committee_history_mv_1_committee_type_full,
ofec_committee_history_mv_1.filing_frequency AS ofec_committee_history_mv_1_filing_frequency,
ofec_committee_history_mv_1.designation AS ofec_committee_history_mv_1_designation,
ofec_committee_history_mv_1.designation_full AS ofec_committee_history_mv_1_designation_full,
ofec_committee_history_mv_1.organization_type AS ofec_committee_history_mv_1_organization_type,
ofec_committee_history_mv_1.organization_type_full AS ofec_committee_history_mv_1_organization_type_full,
ofec_committee_history_mv_1.party AS ofec_committee_history_mv_1_party,
ofec_committee_history_mv_1.party_full AS ofec_committee_history_mv_1_party_full,
ofec_committee_history_mv_1.state AS ofec_committee_history_mv_1_state,
ofec_committee_history_mv_1.street_1 AS ofec_committee_history_mv_1_street_1,
ofec_committee_history_mv_1.street_2 AS ofec_committee_history_mv_1_street_2,
ofec_committee_history_mv_1.city AS ofec_committee_history_mv_1_city,
ofec_committee_history_mv_1.state_full AS ofec_committee_history_mv_1_state_full,
ofec_committee_history_mv_1.zip AS ofec_committee_history_mv_1_zip,
ofec_committee_history_mv_1.candidate_ids AS ofec_committee_history_mv_1_candidate_ids,
ofec_committee_history_mv_1.cycle AS ofec_committee_history_mv_1_cycle,
ofec_committee_history_mv_2.idx AS ofec_committee_history_mv_2_idx,
ofec_committee_history_mv_2.name AS ofec_committee_history_mv_2_name,
ofec_committee_history_mv_2.committee_id AS ofec_committee_history_mv_2_committee_id,
ofec_committee_history_mv_2.cycles AS ofec_committee_history_mv_2_cycles,
ofec_committee_history_mv_2.treasurer_name AS ofec_committee_history_mv_2_treasurer_name,
ofec_committee_history_mv_2.treasurer_text AS ofec_committee_history_mv_2_treasurer_text,
ofec_committee_history_mv_2.committee_type AS ofec_committee_history_mv_2_committee_type,
ofec_committee_history_mv_2.committee_type_full AS ofec_committee_history_mv_2_committee_type_full,
ofec_committee_history_mv_2.filing_frequency AS ofec_committee_history_mv_2_filing_frequency,
ofec_committee_history_mv_2.designation AS ofec_committee_history_mv_2_designation,
ofec_committee_history_mv_2.designation_full AS ofec_committee_history_mv_2_designation_full,
ofec_committee_history_mv_2.organization_type AS ofec_committee_history_mv_2_organization_type,
ofec_committee_history_mv_2.organization_type_full AS ofec_committee_history_mv_2_organization_type_full,
ofec_committee_history_mv_2.party AS ofec_committee_history_mv_2_party,
ofec_committee_history_mv_2.party_full AS ofec_committee_history_mv_2_party_full,
ofec_committee_history_mv_2.state AS ofec_committee_history_mv_2_state,
ofec_committee_history_mv_2.street_1 AS ofec_committee_history_mv_2_street_1,
ofec_committee_history_mv_2.street_2 AS ofec_committee_history_mv_2_street_2,
ofec_committee_history_mv_2.city AS ofec_committee_history_mv_2_city,
ofec_committee_history_mv_2.state_full AS ofec_committee_history_mv_2_state_full,
ofec_committee_history_mv_2.zip AS ofec_committee_history_mv_2_zip,
ofec_committee_history_mv_2.candidate_ids AS ofec_committee_history_mv_2_candidate_ids,
ofec_committee_history_mv_2.cycle AS ofec_committee_history_mv_2_cycle
FROM
disclosure.fec_fitem_sched_a
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_1 ON disclosure.fec_fitem_sched_a.clean_contbr_id = ofec_committee_history_mv_1.committee_id
AND disclosure.fec_fitem_sched_a.rpt_yr + disclosure.fec_fitem_sched_a.rpt_yr % 2 = ofec_committee_history_mv_1.cycle
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_2 ON disclosure.fec_fitem_sched_a.cmte_id = ofec_committee_history_mv_2.committee_id
AND disclosure.fec_fitem_sched_a.rpt_yr + disclosure.fec_fitem_sched_a.rpt_yr % 2 = ofec_committee_history_mv_2.cycle
WHERE
disclosure.fec_fitem_sched_a.two_year_transaction_period = 2018
AND disclosure.fec_fitem_sched_a.contributor_employer_text @@ to_tsquery ('microsoft:*')
AND disclosure.fec_fitem_sched_a.contb_receipt_dt IS NOT NULL
AND (COALESCE (disclosure.fec_fitem_sched_a.contb_receipt_dt, '9999-12-31'::date), disclosure.fec_fitem_sched_a.sub_id)
< ('2018-01-03'::date, 4022320181515163252)
ORDER BY
disclosure.fec_fitem_sched_a.contb_receipt_dt DESC,
disclosure.fec_fitem_sched_a.sub_id DESC
LIMIT 100;
Example 2:
SELECT
disclosure.fec_fitem_sched_a.cmte_id AS disclosure_fec_fitem_sched_a_cmte_id,
disclosure.fec_fitem_sched_a.rpt_yr AS disclosure_fec_fitem_sched_a_rpt_yr,
disclosure.fec_fitem_sched_a.rpt_tp AS disclosure_fec_fitem_sched_a_rpt_tp,
disclosure.fec_fitem_sched_a.image_num AS disclosure_fec_fitem_sched_a_image_num,
disclosure.fec_fitem_sched_a.line_num AS disclosure_fec_fitem_sched_a_line_num,
disclosure.fec_fitem_sched_a.tran_id AS disclosure_fec_fitem_sched_a_tran_id,
disclosure.fec_fitem_sched_a.file_num AS disclosure_fec_fitem_sched_a_file_num,
disclosure.fec_fitem_sched_a.cmte_nm AS disclosure_fec_fitem_sched_a_cmte_nm,
disclosure.fec_fitem_sched_a.entity_tp AS disclosure_fec_fitem_sched_a_entity_tp,
disclosure.fec_fitem_sched_a.entity_tp_desc AS disclosure_fec_fitem_sched_a_entity_tp_desc,
disclosure.fec_fitem_sched_a.contbr_id AS disclosure_fec_fitem_sched_a_contbr_id,
disclosure.fec_fitem_sched_a.contbr_prefix AS disclosure_fec_fitem_sched_a_contbr_prefix,
disclosure.fec_fitem_sched_a.contbr_nm AS disclosure_fec_fitem_sched_a_contbr_nm,
disclosure.fec_fitem_sched_a.contbr_nm_first AS disclosure_fec_fitem_sched_a_contbr_nm_first,
disclosure.fec_fitem_sched_a.contbr_m_nm AS disclosure_fec_fitem_sched_a_contbr_m_nm,
disclosure.fec_fitem_sched_a.contbr_nm_last AS disclosure_fec_fitem_sched_a_contbr_nm_last,
disclosure.fec_fitem_sched_a.contbr_suffix AS disclosure_fec_fitem_sched_a_contbr_suffix,
disclosure.fec_fitem_sched_a.contbr_st1 AS disclosure_fec_fitem_sched_a_contbr_st1,
disclosure.fec_fitem_sched_a.contbr_st2 AS disclosure_fec_fitem_sched_a_contbr_st2,
disclosure.fec_fitem_sched_a.contbr_city AS disclosure_fec_fitem_sched_a_contbr_city,
disclosure.fec_fitem_sched_a.contbr_st AS disclosure_fec_fitem_sched_a_contbr_st,
disclosure.fec_fitem_sched_a.contbr_zip AS disclosure_fec_fitem_sched_a_contbr_zip,
disclosure.fec_fitem_sched_a.contbr_employer AS disclosure_fec_fitem_sched_a_contbr_employer,
disclosure.fec_fitem_sched_a.contbr_occupation AS disclosure_fec_fitem_sched_a_contbr_occupation,
disclosure.fec_fitem_sched_a.clean_contbr_id AS disclosure_fec_fitem_sched_a_clean_contbr_id,
disclosure.fec_fitem_sched_a.receipt_tp AS disclosure_fec_fitem_sched_a_receipt_tp,
disclosure.fec_fitem_sched_a.receipt_tp_desc AS disclosure_fec_fitem_sched_a_receipt_tp_desc,
disclosure.fec_fitem_sched_a.receipt_desc AS disclosure_fec_fitem_sched_a_receipt_desc,
disclosure.fec_fitem_sched_a.memo_cd AS disclosure_fec_fitem_sched_a_memo_cd,
disclosure.fec_fitem_sched_a.memo_cd_desc AS disclosure_fec_fitem_sched_a_memo_cd_desc,
disclosure.fec_fitem_sched_a.contb_receipt_dt AS disclosure_fec_fitem_sched_a_contb_receipt_dt,
disclosure.fec_fitem_sched_a.contb_receipt_amt AS disclosure_fec_fitem_sched_a_contb_receipt_amt,
disclosure.fec_fitem_sched_a.contb_aggregate_ytd AS disclosure_fec_fitem_sched_a_contb_aggregate_ytd,
disclosure.fec_fitem_sched_a.cand_id AS disclosure_fec_fitem_sched_a_cand_id,
disclosure.fec_fitem_sched_a.cand_nm AS disclosure_fec_fitem_sched_a_cand_nm,
disclosure.fec_fitem_sched_a.cand_nm_first AS disclosure_fec_fitem_sched_a_cand_nm_first,
disclosure.fec_fitem_sched_a.cand_nm_last AS disclosure_fec_fitem_sched_a_cand_nm_last,
disclosure.fec_fitem_sched_a.cand_m_nm AS disclosure_fec_fitem_sched_a_cand_m_nm,
disclosure.fec_fitem_sched_a.cand_prefix AS disclosure_fec_fitem_sched_a_cand_prefix,
disclosure.fec_fitem_sched_a.cand_suffix AS disclosure_fec_fitem_sched_a_cand_suffix,
disclosure.fec_fitem_sched_a.cand_office AS disclosure_fec_fitem_sched_a_cand_office,
disclosure.fec_fitem_sched_a.cand_office_desc AS disclosure_fec_fitem_sched_a_cand_office_desc,
disclosure.fec_fitem_sched_a.cand_office_st AS disclosure_fec_fitem_sched_a_cand_office_st,
disclosure.fec_fitem_sched_a.cand_office_st_desc AS disclosure_fec_fitem_sched_a_cand_office_st_desc,
disclosure.fec_fitem_sched_a.cand_office_district AS disclosure_fec_fitem_sched_a_cand_office_district,
disclosure.fec_fitem_sched_a.conduit_cmte_id AS disclosure_fec_fitem_sched_a_conduit_cmte_id,
disclosure.fec_fitem_sched_a.conduit_cmte_nm AS disclosure_fec_fitem_sched_a_conduit_cmte_nm,
disclosure.fec_fitem_sched_a.conduit_cmte_st1 AS disclosure_fec_fitem_sched_a_conduit_cmte_st1,
disclosure.fec_fitem_sched_a.conduit_cmte_st2 AS disclosure_fec_fitem_sched_a_conduit_cmte_st2,
disclosure.fec_fitem_sched_a.conduit_cmte_city AS disclosure_fec_fitem_sched_a_conduit_cmte_city,
disclosure.fec_fitem_sched_a.conduit_cmte_st AS disclosure_fec_fitem_sched_a_conduit_cmte_st,
disclosure.fec_fitem_sched_a.conduit_cmte_zip AS disclosure_fec_fitem_sched_a_conduit_cmte_zip,
disclosure.fec_fitem_sched_a.donor_cmte_nm AS disclosure_fec_fitem_sched_a_donor_cmte_nm,
disclosure.fec_fitem_sched_a.national_cmte_nonfed_acct AS disclosure_fec_fitem_sched_a_national_cmte_nonfed_acct,
disclosure.fec_fitem_sched_a.election_tp AS disclosure_fec_fitem_sched_a_election_tp,
disclosure.fec_fitem_sched_a.election_tp_desc AS disclosure_fec_fitem_sched_a_election_tp_desc,
disclosure.fec_fitem_sched_a.fec_election_tp_desc AS disclosure_fec_fitem_sched_a_fec_election_tp_desc,
disclosure.fec_fitem_sched_a.fec_election_yr AS disclosure_fec_fitem_sched_a_fec_election_yr,
disclosure.fec_fitem_sched_a.action_cd AS disclosure_fec_fitem_sched_a_action_cd,
disclosure.fec_fitem_sched_a.action_cd_desc AS disclosure_fec_fitem_sched_a_action_cd_desc,
disclosure.fec_fitem_sched_a.schedule_type_desc AS disclosure_fec_fitem_sched_a_schedule_type_desc,
disclosure.fec_fitem_sched_a.pg_date AS disclosure_fec_fitem_sched_a_pg_date,
disclosure.fec_fitem_sched_a.orig_sub_id AS disclosure_fec_fitem_sched_a_orig_sub_id,
disclosure.fec_fitem_sched_a.back_ref_tran_id AS disclosure_fec_fitem_sched_a_back_ref_tran_id,
disclosure.fec_fitem_sched_a.back_ref_sched_nm AS disclosure_fec_fitem_sched_a_back_ref_sched_nm,
disclosure.fec_fitem_sched_a.filing_form AS disclosure_fec_fitem_sched_a_filing_form,
disclosure.fec_fitem_sched_a.link_id AS disclosure_fec_fitem_sched_a_link_id,
disclosure.fec_fitem_sched_a.contributor_name_text AS disclosure_fec_fitem_sched_a_contributor_name_text,
disclosure.fec_fitem_sched_a.contributor_employer_text AS disclosure_fec_fitem_sched_a_contributor_employer_text,
disclosure.fec_fitem_sched_a.contributor_occupation_text AS disclosure_fec_fitem_sched_a_contributor_occupation_text,
disclosure.fec_fitem_sched_a.is_individual AS disclosure_fec_fitem_sched_a_is_individual,
disclosure.fec_fitem_sched_a.memo_text AS disclosure_fec_fitem_sched_a_memo_text,
disclosure.fec_fitem_sched_a.two_year_transaction_period AS disclosure_fec_fitem_sched_a_two_year_transaction_period,
disclosure.fec_fitem_sched_a.schedule_type AS disclosure_fec_fitem_sched_a_schedule_type,
disclosure.fec_fitem_sched_a.increased_limit AS disclosure_fec_fitem_sched_a_increased_limit,
disclosure.fec_fitem_sched_a.sub_id AS disclosure_fec_fitem_sched_a_sub_id,
disclosure.fec_fitem_sched_a.pdf_url AS disclosure_fec_fitem_sched_a_pdf_url,
disclosure.fec_fitem_sched_a.line_number_label AS disclosure_fec_fitem_sched_a_line_number_label,
ofec_committee_history_mv_1.idx AS ofec_committee_history_mv_1_idx,
ofec_committee_history_mv_1.name AS ofec_committee_history_mv_1_name,
ofec_committee_history_mv_1.committee_id AS ofec_committee_history_mv_1_committee_id,
ofec_committee_history_mv_1.cycles AS ofec_committee_history_mv_1_cycles,
ofec_committee_history_mv_1.treasurer_name AS ofec_committee_history_mv_1_treasurer_name,
ofec_committee_history_mv_1.treasurer_text AS ofec_committee_history_mv_1_treasurer_text,
ofec_committee_history_mv_1.committee_type AS ofec_committee_history_mv_1_committee_type,
ofec_committee_history_mv_1.committee_type_full AS ofec_committee_history_mv_1_committee_type_full,
ofec_committee_history_mv_1.filing_frequency AS ofec_committee_history_mv_1_filing_frequency,
ofec_committee_history_mv_1.designation AS ofec_committee_history_mv_1_designation,
ofec_committee_history_mv_1.designation_full AS ofec_committee_history_mv_1_designation_full,
ofec_committee_history_mv_1.organization_type AS ofec_committee_history_mv_1_organization_type,
ofec_committee_history_mv_1.organization_type_full AS ofec_committee_history_mv_1_organization_type_full,
ofec_committee_history_mv_1.party AS ofec_committee_history_mv_1_party,
ofec_committee_history_mv_1.party_full AS ofec_committee_history_mv_1_party_full,
ofec_committee_history_mv_1.state AS ofec_committee_history_mv_1_state,
ofec_committee_history_mv_1.street_1 AS ofec_committee_history_mv_1_street_1,
ofec_committee_history_mv_1.street_2 AS ofec_committee_history_mv_1_street_2,
ofec_committee_history_mv_1.city AS ofec_committee_history_mv_1_city,
ofec_committee_history_mv_1.state_full AS ofec_committee_history_mv_1_state_full,
ofec_committee_history_mv_1.zip AS ofec_committee_history_mv_1_zip,
ofec_committee_history_mv_1.candidate_ids AS ofec_committee_history_mv_1_candidate_ids,
ofec_committee_history_mv_1.cycle AS ofec_committee_history_mv_1_cycle,
ofec_committee_history_mv_2.idx AS ofec_committee_history_mv_2_idx,
ofec_committee_history_mv_2.name AS ofec_committee_history_mv_2_name,
ofec_committee_history_mv_2.committee_id AS ofec_committee_history_mv_2_committee_id,
ofec_committee_history_mv_2.cycles AS ofec_committee_history_mv_2_cycles,
ofec_committee_history_mv_2.treasurer_name AS ofec_committee_history_mv_2_treasurer_name,
ofec_committee_history_mv_2.treasurer_text AS ofec_committee_history_mv_2_treasurer_text,
ofec_committee_history_mv_2.committee_type AS ofec_committee_history_mv_2_committee_type,
ofec_committee_history_mv_2.committee_type_full AS ofec_committee_history_mv_2_committee_type_full,
ofec_committee_history_mv_2.filing_frequency AS ofec_committee_history_mv_2_filing_frequency,
ofec_committee_history_mv_2.designation AS ofec_committee_history_mv_2_designation,
ofec_committee_history_mv_2.designation_full AS ofec_committee_history_mv_2_designation_full,
ofec_committee_history_mv_2.organization_type AS ofec_committee_history_mv_2_organization_type,
ofec_committee_history_mv_2.organization_type_full AS ofec_committee_history_mv_2_organization_type_full,
ofec_committee_history_mv_2.party AS ofec_committee_history_mv_2_party,
ofec_committee_history_mv_2.party_full AS ofec_committee_history_mv_2_party_full,
ofec_committee_history_mv_2.state AS ofec_committee_history_mv_2_state,
ofec_committee_history_mv_2.street_1 AS ofec_committee_history_mv_2_street_1,
ofec_committee_history_mv_2.street_2 AS ofec_committee_history_mv_2_street_2,
ofec_committee_history_mv_2.city AS ofec_committee_history_mv_2_city,
ofec_committee_history_mv_2.state_full AS ofec_committee_history_mv_2_state_full,
ofec_committee_history_mv_2.zip AS ofec_committee_history_mv_2_zip,
ofec_committee_history_mv_2.candidate_ids AS ofec_committee_history_mv_2_candidate_ids,
ofec_committee_history_mv_2.cycle AS ofec_committee_history_mv_2_cycle
FROM
disclosure.fec_fitem_sched_a
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_1 ON disclosure.fec_fitem_sched_a.clean_contbr_id = ofec_committee_history_mv_1.committee_id
AND disclosure.fec_fitem_sched_a.rpt_yr + disclosure.fec_fitem_sched_a.rpt_yr % 2 = ofec_committee_history_mv_1.cycle
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_2 ON disclosure.fec_fitem_sched_a.cmte_id = ofec_committee_history_mv_2.committee_id
AND disclosure.fec_fitem_sched_a.rpt_yr + disclosure.fec_fitem_sched_a.rpt_yr % 2 = ofec_committee_history_mv_2.cycle
WHERE
disclosure.fec_fitem_sched_a.two_year_transaction_period = 2016
AND disclosure.fec_fitem_sched_a.cmte_id IN ('C00401224')
AND disclosure.fec_fitem_sched_a.contb_receipt_dt >= '2015-05-16'::date
AND (COALESCE (disclosure.fec_fitem_sched_a.contb_receipt_dt, '9999-12-31'::date), disclosure.fec_fitem_sched_a.sub_id)
> ('2015-09-07'::date, 4021620161267723870)
ORDER BY
disclosure.fec_fitem_sched_a.contb_receipt_dt ASC,
disclosure.fec_fitem_sched_a.sub_id ASC
LIMIT 100;
The text was updated successfully, but these errors were encountered:
From PGBadger most time consuming queries report, Schedule A query is taking more than 10 sec to execute. Below are two examples of the actual Schedule A query.
Completion Criteria:
other tables.
Ex: We added committee_type filter to the Schedule A and Schedule B tables.Add column cmte_tp to fec_fitem_sched_a and fec_fitem_sched_b tables #3379
Example 1:
SELECT
disclosure.fec_fitem_sched_a.cmte_id AS disclosure_fec_fitem_sched_a_cmte_id,
disclosure.fec_fitem_sched_a.rpt_yr AS disclosure_fec_fitem_sched_a_rpt_yr,
disclosure.fec_fitem_sched_a.rpt_tp AS disclosure_fec_fitem_sched_a_rpt_tp,
disclosure.fec_fitem_sched_a.image_num AS disclosure_fec_fitem_sched_a_image_num,
disclosure.fec_fitem_sched_a.line_num AS disclosure_fec_fitem_sched_a_line_num,
disclosure.fec_fitem_sched_a.tran_id AS disclosure_fec_fitem_sched_a_tran_id,
disclosure.fec_fitem_sched_a.file_num AS disclosure_fec_fitem_sched_a_file_num,
disclosure.fec_fitem_sched_a.cmte_nm AS disclosure_fec_fitem_sched_a_cmte_nm,
disclosure.fec_fitem_sched_a.entity_tp AS disclosure_fec_fitem_sched_a_entity_tp,
disclosure.fec_fitem_sched_a.entity_tp_desc AS disclosure_fec_fitem_sched_a_entity_tp_desc,
disclosure.fec_fitem_sched_a.contbr_id AS disclosure_fec_fitem_sched_a_contbr_id,
disclosure.fec_fitem_sched_a.contbr_prefix AS disclosure_fec_fitem_sched_a_contbr_prefix,
disclosure.fec_fitem_sched_a.contbr_nm AS disclosure_fec_fitem_sched_a_contbr_nm,
disclosure.fec_fitem_sched_a.contbr_nm_first AS disclosure_fec_fitem_sched_a_contbr_nm_first,
disclosure.fec_fitem_sched_a.contbr_m_nm AS disclosure_fec_fitem_sched_a_contbr_m_nm,
disclosure.fec_fitem_sched_a.contbr_nm_last AS disclosure_fec_fitem_sched_a_contbr_nm_last,
disclosure.fec_fitem_sched_a.contbr_suffix AS disclosure_fec_fitem_sched_a_contbr_suffix,
disclosure.fec_fitem_sched_a.contbr_st1 AS disclosure_fec_fitem_sched_a_contbr_st1,
disclosure.fec_fitem_sched_a.contbr_st2 AS disclosure_fec_fitem_sched_a_contbr_st2,
disclosure.fec_fitem_sched_a.contbr_city AS disclosure_fec_fitem_sched_a_contbr_city,
disclosure.fec_fitem_sched_a.contbr_st AS disclosure_fec_fitem_sched_a_contbr_st,
disclosure.fec_fitem_sched_a.contbr_zip AS disclosure_fec_fitem_sched_a_contbr_zip,
disclosure.fec_fitem_sched_a.contbr_employer AS disclosure_fec_fitem_sched_a_contbr_employer,
disclosure.fec_fitem_sched_a.contbr_occupation AS disclosure_fec_fitem_sched_a_contbr_occupation,
disclosure.fec_fitem_sched_a.clean_contbr_id AS disclosure_fec_fitem_sched_a_clean_contbr_id,
disclosure.fec_fitem_sched_a.receipt_tp AS disclosure_fec_fitem_sched_a_receipt_tp,
disclosure.fec_fitem_sched_a.receipt_tp_desc AS disclosure_fec_fitem_sched_a_receipt_tp_desc,
disclosure.fec_fitem_sched_a.receipt_desc AS disclosure_fec_fitem_sched_a_receipt_desc,
disclosure.fec_fitem_sched_a.memo_cd AS disclosure_fec_fitem_sched_a_memo_cd,
disclosure.fec_fitem_sched_a.memo_cd_desc AS disclosure_fec_fitem_sched_a_memo_cd_desc,
disclosure.fec_fitem_sched_a.contb_receipt_dt AS disclosure_fec_fitem_sched_a_contb_receipt_dt,
disclosure.fec_fitem_sched_a.contb_receipt_amt AS disclosure_fec_fitem_sched_a_contb_receipt_amt,
disclosure.fec_fitem_sched_a.contb_aggregate_ytd AS disclosure_fec_fitem_sched_a_contb_aggregate_ytd,
disclosure.fec_fitem_sched_a.cand_id AS disclosure_fec_fitem_sched_a_cand_id,
disclosure.fec_fitem_sched_a.cand_nm AS disclosure_fec_fitem_sched_a_cand_nm,
disclosure.fec_fitem_sched_a.cand_nm_first AS disclosure_fec_fitem_sched_a_cand_nm_first,
disclosure.fec_fitem_sched_a.cand_nm_last AS disclosure_fec_fitem_sched_a_cand_nm_last,
disclosure.fec_fitem_sched_a.cand_m_nm AS disclosure_fec_fitem_sched_a_cand_m_nm,
disclosure.fec_fitem_sched_a.cand_prefix AS disclosure_fec_fitem_sched_a_cand_prefix,
disclosure.fec_fitem_sched_a.cand_suffix AS disclosure_fec_fitem_sched_a_cand_suffix,
disclosure.fec_fitem_sched_a.cand_office AS disclosure_fec_fitem_sched_a_cand_office,
disclosure.fec_fitem_sched_a.cand_office_desc AS disclosure_fec_fitem_sched_a_cand_office_desc,
disclosure.fec_fitem_sched_a.cand_office_st AS disclosure_fec_fitem_sched_a_cand_office_st,
disclosure.fec_fitem_sched_a.cand_office_st_desc AS disclosure_fec_fitem_sched_a_cand_office_st_desc,
disclosure.fec_fitem_sched_a.cand_office_district AS disclosure_fec_fitem_sched_a_cand_office_district,
disclosure.fec_fitem_sched_a.conduit_cmte_id AS disclosure_fec_fitem_sched_a_conduit_cmte_id,
disclosure.fec_fitem_sched_a.conduit_cmte_nm AS disclosure_fec_fitem_sched_a_conduit_cmte_nm,
disclosure.fec_fitem_sched_a.conduit_cmte_st1 AS disclosure_fec_fitem_sched_a_conduit_cmte_st1,
disclosure.fec_fitem_sched_a.conduit_cmte_st2 AS disclosure_fec_fitem_sched_a_conduit_cmte_st2,
disclosure.fec_fitem_sched_a.conduit_cmte_city AS disclosure_fec_fitem_sched_a_conduit_cmte_city,
disclosure.fec_fitem_sched_a.conduit_cmte_st AS disclosure_fec_fitem_sched_a_conduit_cmte_st,
disclosure.fec_fitem_sched_a.conduit_cmte_zip AS disclosure_fec_fitem_sched_a_conduit_cmte_zip,
disclosure.fec_fitem_sched_a.donor_cmte_nm AS disclosure_fec_fitem_sched_a_donor_cmte_nm,
disclosure.fec_fitem_sched_a.national_cmte_nonfed_acct AS disclosure_fec_fitem_sched_a_national_cmte_nonfed_acct,
disclosure.fec_fitem_sched_a.election_tp AS disclosure_fec_fitem_sched_a_election_tp,
disclosure.fec_fitem_sched_a.election_tp_desc AS disclosure_fec_fitem_sched_a_election_tp_desc,
disclosure.fec_fitem_sched_a.fec_election_tp_desc AS disclosure_fec_fitem_sched_a_fec_election_tp_desc,
disclosure.fec_fitem_sched_a.fec_election_yr AS disclosure_fec_fitem_sched_a_fec_election_yr,
disclosure.fec_fitem_sched_a.action_cd AS disclosure_fec_fitem_sched_a_action_cd,
disclosure.fec_fitem_sched_a.action_cd_desc AS disclosure_fec_fitem_sched_a_action_cd_desc,
disclosure.fec_fitem_sched_a.schedule_type_desc AS disclosure_fec_fitem_sched_a_schedule_type_desc,
disclosure.fec_fitem_sched_a.pg_date AS disclosure_fec_fitem_sched_a_pg_date,
disclosure.fec_fitem_sched_a.orig_sub_id AS disclosure_fec_fitem_sched_a_orig_sub_id,
disclosure.fec_fitem_sched_a.back_ref_tran_id AS disclosure_fec_fitem_sched_a_back_ref_tran_id,
disclosure.fec_fitem_sched_a.back_ref_sched_nm AS disclosure_fec_fitem_sched_a_back_ref_sched_nm,
disclosure.fec_fitem_sched_a.filing_form AS disclosure_fec_fitem_sched_a_filing_form,
disclosure.fec_fitem_sched_a.link_id AS disclosure_fec_fitem_sched_a_link_id,
disclosure.fec_fitem_sched_a.contributor_name_text AS disclosure_fec_fitem_sched_a_contributor_name_text,
disclosure.fec_fitem_sched_a.contributor_employer_text AS disclosure_fec_fitem_sched_a_contributor_employer_text,
disclosure.fec_fitem_sched_a.contributor_occupation_text AS disclosure_fec_fitem_sched_a_contributor_occupation_text,
disclosure.fec_fitem_sched_a.is_individual AS disclosure_fec_fitem_sched_a_is_individual,
disclosure.fec_fitem_sched_a.memo_text AS disclosure_fec_fitem_sched_a_memo_text,
disclosure.fec_fitem_sched_a.two_year_transaction_period AS disclosure_fec_fitem_sched_a_two_year_transaction_period,
disclosure.fec_fitem_sched_a.schedule_type AS disclosure_fec_fitem_sched_a_schedule_type,
disclosure.fec_fitem_sched_a.increased_limit AS disclosure_fec_fitem_sched_a_increased_limit,
disclosure.fec_fitem_sched_a.sub_id AS disclosure_fec_fitem_sched_a_sub_id,
disclosure.fec_fitem_sched_a.pdf_url AS disclosure_fec_fitem_sched_a_pdf_url,
disclosure.fec_fitem_sched_a.line_number_label AS disclosure_fec_fitem_sched_a_line_number_label,
ofec_committee_history_mv_1.idx AS ofec_committee_history_mv_1_idx,
ofec_committee_history_mv_1.name AS ofec_committee_history_mv_1_name,
ofec_committee_history_mv_1.committee_id AS ofec_committee_history_mv_1_committee_id,
ofec_committee_history_mv_1.cycles AS ofec_committee_history_mv_1_cycles,
ofec_committee_history_mv_1.treasurer_name AS ofec_committee_history_mv_1_treasurer_name,
ofec_committee_history_mv_1.treasurer_text AS ofec_committee_history_mv_1_treasurer_text,
ofec_committee_history_mv_1.committee_type AS ofec_committee_history_mv_1_committee_type,
ofec_committee_history_mv_1.committee_type_full AS ofec_committee_history_mv_1_committee_type_full,
ofec_committee_history_mv_1.filing_frequency AS ofec_committee_history_mv_1_filing_frequency,
ofec_committee_history_mv_1.designation AS ofec_committee_history_mv_1_designation,
ofec_committee_history_mv_1.designation_full AS ofec_committee_history_mv_1_designation_full,
ofec_committee_history_mv_1.organization_type AS ofec_committee_history_mv_1_organization_type,
ofec_committee_history_mv_1.organization_type_full AS ofec_committee_history_mv_1_organization_type_full,
ofec_committee_history_mv_1.party AS ofec_committee_history_mv_1_party,
ofec_committee_history_mv_1.party_full AS ofec_committee_history_mv_1_party_full,
ofec_committee_history_mv_1.state AS ofec_committee_history_mv_1_state,
ofec_committee_history_mv_1.street_1 AS ofec_committee_history_mv_1_street_1,
ofec_committee_history_mv_1.street_2 AS ofec_committee_history_mv_1_street_2,
ofec_committee_history_mv_1.city AS ofec_committee_history_mv_1_city,
ofec_committee_history_mv_1.state_full AS ofec_committee_history_mv_1_state_full,
ofec_committee_history_mv_1.zip AS ofec_committee_history_mv_1_zip,
ofec_committee_history_mv_1.candidate_ids AS ofec_committee_history_mv_1_candidate_ids,
ofec_committee_history_mv_1.cycle AS ofec_committee_history_mv_1_cycle,
ofec_committee_history_mv_2.idx AS ofec_committee_history_mv_2_idx,
ofec_committee_history_mv_2.name AS ofec_committee_history_mv_2_name,
ofec_committee_history_mv_2.committee_id AS ofec_committee_history_mv_2_committee_id,
ofec_committee_history_mv_2.cycles AS ofec_committee_history_mv_2_cycles,
ofec_committee_history_mv_2.treasurer_name AS ofec_committee_history_mv_2_treasurer_name,
ofec_committee_history_mv_2.treasurer_text AS ofec_committee_history_mv_2_treasurer_text,
ofec_committee_history_mv_2.committee_type AS ofec_committee_history_mv_2_committee_type,
ofec_committee_history_mv_2.committee_type_full AS ofec_committee_history_mv_2_committee_type_full,
ofec_committee_history_mv_2.filing_frequency AS ofec_committee_history_mv_2_filing_frequency,
ofec_committee_history_mv_2.designation AS ofec_committee_history_mv_2_designation,
ofec_committee_history_mv_2.designation_full AS ofec_committee_history_mv_2_designation_full,
ofec_committee_history_mv_2.organization_type AS ofec_committee_history_mv_2_organization_type,
ofec_committee_history_mv_2.organization_type_full AS ofec_committee_history_mv_2_organization_type_full,
ofec_committee_history_mv_2.party AS ofec_committee_history_mv_2_party,
ofec_committee_history_mv_2.party_full AS ofec_committee_history_mv_2_party_full,
ofec_committee_history_mv_2.state AS ofec_committee_history_mv_2_state,
ofec_committee_history_mv_2.street_1 AS ofec_committee_history_mv_2_street_1,
ofec_committee_history_mv_2.street_2 AS ofec_committee_history_mv_2_street_2,
ofec_committee_history_mv_2.city AS ofec_committee_history_mv_2_city,
ofec_committee_history_mv_2.state_full AS ofec_committee_history_mv_2_state_full,
ofec_committee_history_mv_2.zip AS ofec_committee_history_mv_2_zip,
ofec_committee_history_mv_2.candidate_ids AS ofec_committee_history_mv_2_candidate_ids,
ofec_committee_history_mv_2.cycle AS ofec_committee_history_mv_2_cycle
FROM
disclosure.fec_fitem_sched_a
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_1 ON disclosure.fec_fitem_sched_a.clean_contbr_id = ofec_committee_history_mv_1.committee_id
AND disclosure.fec_fitem_sched_a.rpt_yr + disclosure.fec_fitem_sched_a.rpt_yr % 2 = ofec_committee_history_mv_1.cycle
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_2 ON disclosure.fec_fitem_sched_a.cmte_id = ofec_committee_history_mv_2.committee_id
AND disclosure.fec_fitem_sched_a.rpt_yr + disclosure.fec_fitem_sched_a.rpt_yr % 2 = ofec_committee_history_mv_2.cycle
WHERE
disclosure.fec_fitem_sched_a.two_year_transaction_period = 2018
AND disclosure.fec_fitem_sched_a.contributor_employer_text @@ to_tsquery ('microsoft:*')
AND disclosure.fec_fitem_sched_a.contb_receipt_dt IS NOT NULL
AND (COALESCE (disclosure.fec_fitem_sched_a.contb_receipt_dt, '9999-12-31'::date), disclosure.fec_fitem_sched_a.sub_id)
< ('2018-01-03'::date, 4022320181515163252)
ORDER BY
disclosure.fec_fitem_sched_a.contb_receipt_dt DESC,
disclosure.fec_fitem_sched_a.sub_id DESC
LIMIT 100;
Example 2:
SELECT
disclosure.fec_fitem_sched_a.cmte_id AS disclosure_fec_fitem_sched_a_cmte_id,
disclosure.fec_fitem_sched_a.rpt_yr AS disclosure_fec_fitem_sched_a_rpt_yr,
disclosure.fec_fitem_sched_a.rpt_tp AS disclosure_fec_fitem_sched_a_rpt_tp,
disclosure.fec_fitem_sched_a.image_num AS disclosure_fec_fitem_sched_a_image_num,
disclosure.fec_fitem_sched_a.line_num AS disclosure_fec_fitem_sched_a_line_num,
disclosure.fec_fitem_sched_a.tran_id AS disclosure_fec_fitem_sched_a_tran_id,
disclosure.fec_fitem_sched_a.file_num AS disclosure_fec_fitem_sched_a_file_num,
disclosure.fec_fitem_sched_a.cmte_nm AS disclosure_fec_fitem_sched_a_cmte_nm,
disclosure.fec_fitem_sched_a.entity_tp AS disclosure_fec_fitem_sched_a_entity_tp,
disclosure.fec_fitem_sched_a.entity_tp_desc AS disclosure_fec_fitem_sched_a_entity_tp_desc,
disclosure.fec_fitem_sched_a.contbr_id AS disclosure_fec_fitem_sched_a_contbr_id,
disclosure.fec_fitem_sched_a.contbr_prefix AS disclosure_fec_fitem_sched_a_contbr_prefix,
disclosure.fec_fitem_sched_a.contbr_nm AS disclosure_fec_fitem_sched_a_contbr_nm,
disclosure.fec_fitem_sched_a.contbr_nm_first AS disclosure_fec_fitem_sched_a_contbr_nm_first,
disclosure.fec_fitem_sched_a.contbr_m_nm AS disclosure_fec_fitem_sched_a_contbr_m_nm,
disclosure.fec_fitem_sched_a.contbr_nm_last AS disclosure_fec_fitem_sched_a_contbr_nm_last,
disclosure.fec_fitem_sched_a.contbr_suffix AS disclosure_fec_fitem_sched_a_contbr_suffix,
disclosure.fec_fitem_sched_a.contbr_st1 AS disclosure_fec_fitem_sched_a_contbr_st1,
disclosure.fec_fitem_sched_a.contbr_st2 AS disclosure_fec_fitem_sched_a_contbr_st2,
disclosure.fec_fitem_sched_a.contbr_city AS disclosure_fec_fitem_sched_a_contbr_city,
disclosure.fec_fitem_sched_a.contbr_st AS disclosure_fec_fitem_sched_a_contbr_st,
disclosure.fec_fitem_sched_a.contbr_zip AS disclosure_fec_fitem_sched_a_contbr_zip,
disclosure.fec_fitem_sched_a.contbr_employer AS disclosure_fec_fitem_sched_a_contbr_employer,
disclosure.fec_fitem_sched_a.contbr_occupation AS disclosure_fec_fitem_sched_a_contbr_occupation,
disclosure.fec_fitem_sched_a.clean_contbr_id AS disclosure_fec_fitem_sched_a_clean_contbr_id,
disclosure.fec_fitem_sched_a.receipt_tp AS disclosure_fec_fitem_sched_a_receipt_tp,
disclosure.fec_fitem_sched_a.receipt_tp_desc AS disclosure_fec_fitem_sched_a_receipt_tp_desc,
disclosure.fec_fitem_sched_a.receipt_desc AS disclosure_fec_fitem_sched_a_receipt_desc,
disclosure.fec_fitem_sched_a.memo_cd AS disclosure_fec_fitem_sched_a_memo_cd,
disclosure.fec_fitem_sched_a.memo_cd_desc AS disclosure_fec_fitem_sched_a_memo_cd_desc,
disclosure.fec_fitem_sched_a.contb_receipt_dt AS disclosure_fec_fitem_sched_a_contb_receipt_dt,
disclosure.fec_fitem_sched_a.contb_receipt_amt AS disclosure_fec_fitem_sched_a_contb_receipt_amt,
disclosure.fec_fitem_sched_a.contb_aggregate_ytd AS disclosure_fec_fitem_sched_a_contb_aggregate_ytd,
disclosure.fec_fitem_sched_a.cand_id AS disclosure_fec_fitem_sched_a_cand_id,
disclosure.fec_fitem_sched_a.cand_nm AS disclosure_fec_fitem_sched_a_cand_nm,
disclosure.fec_fitem_sched_a.cand_nm_first AS disclosure_fec_fitem_sched_a_cand_nm_first,
disclosure.fec_fitem_sched_a.cand_nm_last AS disclosure_fec_fitem_sched_a_cand_nm_last,
disclosure.fec_fitem_sched_a.cand_m_nm AS disclosure_fec_fitem_sched_a_cand_m_nm,
disclosure.fec_fitem_sched_a.cand_prefix AS disclosure_fec_fitem_sched_a_cand_prefix,
disclosure.fec_fitem_sched_a.cand_suffix AS disclosure_fec_fitem_sched_a_cand_suffix,
disclosure.fec_fitem_sched_a.cand_office AS disclosure_fec_fitem_sched_a_cand_office,
disclosure.fec_fitem_sched_a.cand_office_desc AS disclosure_fec_fitem_sched_a_cand_office_desc,
disclosure.fec_fitem_sched_a.cand_office_st AS disclosure_fec_fitem_sched_a_cand_office_st,
disclosure.fec_fitem_sched_a.cand_office_st_desc AS disclosure_fec_fitem_sched_a_cand_office_st_desc,
disclosure.fec_fitem_sched_a.cand_office_district AS disclosure_fec_fitem_sched_a_cand_office_district,
disclosure.fec_fitem_sched_a.conduit_cmte_id AS disclosure_fec_fitem_sched_a_conduit_cmte_id,
disclosure.fec_fitem_sched_a.conduit_cmte_nm AS disclosure_fec_fitem_sched_a_conduit_cmte_nm,
disclosure.fec_fitem_sched_a.conduit_cmte_st1 AS disclosure_fec_fitem_sched_a_conduit_cmte_st1,
disclosure.fec_fitem_sched_a.conduit_cmte_st2 AS disclosure_fec_fitem_sched_a_conduit_cmte_st2,
disclosure.fec_fitem_sched_a.conduit_cmte_city AS disclosure_fec_fitem_sched_a_conduit_cmte_city,
disclosure.fec_fitem_sched_a.conduit_cmte_st AS disclosure_fec_fitem_sched_a_conduit_cmte_st,
disclosure.fec_fitem_sched_a.conduit_cmte_zip AS disclosure_fec_fitem_sched_a_conduit_cmte_zip,
disclosure.fec_fitem_sched_a.donor_cmte_nm AS disclosure_fec_fitem_sched_a_donor_cmte_nm,
disclosure.fec_fitem_sched_a.national_cmte_nonfed_acct AS disclosure_fec_fitem_sched_a_national_cmte_nonfed_acct,
disclosure.fec_fitem_sched_a.election_tp AS disclosure_fec_fitem_sched_a_election_tp,
disclosure.fec_fitem_sched_a.election_tp_desc AS disclosure_fec_fitem_sched_a_election_tp_desc,
disclosure.fec_fitem_sched_a.fec_election_tp_desc AS disclosure_fec_fitem_sched_a_fec_election_tp_desc,
disclosure.fec_fitem_sched_a.fec_election_yr AS disclosure_fec_fitem_sched_a_fec_election_yr,
disclosure.fec_fitem_sched_a.action_cd AS disclosure_fec_fitem_sched_a_action_cd,
disclosure.fec_fitem_sched_a.action_cd_desc AS disclosure_fec_fitem_sched_a_action_cd_desc,
disclosure.fec_fitem_sched_a.schedule_type_desc AS disclosure_fec_fitem_sched_a_schedule_type_desc,
disclosure.fec_fitem_sched_a.pg_date AS disclosure_fec_fitem_sched_a_pg_date,
disclosure.fec_fitem_sched_a.orig_sub_id AS disclosure_fec_fitem_sched_a_orig_sub_id,
disclosure.fec_fitem_sched_a.back_ref_tran_id AS disclosure_fec_fitem_sched_a_back_ref_tran_id,
disclosure.fec_fitem_sched_a.back_ref_sched_nm AS disclosure_fec_fitem_sched_a_back_ref_sched_nm,
disclosure.fec_fitem_sched_a.filing_form AS disclosure_fec_fitem_sched_a_filing_form,
disclosure.fec_fitem_sched_a.link_id AS disclosure_fec_fitem_sched_a_link_id,
disclosure.fec_fitem_sched_a.contributor_name_text AS disclosure_fec_fitem_sched_a_contributor_name_text,
disclosure.fec_fitem_sched_a.contributor_employer_text AS disclosure_fec_fitem_sched_a_contributor_employer_text,
disclosure.fec_fitem_sched_a.contributor_occupation_text AS disclosure_fec_fitem_sched_a_contributor_occupation_text,
disclosure.fec_fitem_sched_a.is_individual AS disclosure_fec_fitem_sched_a_is_individual,
disclosure.fec_fitem_sched_a.memo_text AS disclosure_fec_fitem_sched_a_memo_text,
disclosure.fec_fitem_sched_a.two_year_transaction_period AS disclosure_fec_fitem_sched_a_two_year_transaction_period,
disclosure.fec_fitem_sched_a.schedule_type AS disclosure_fec_fitem_sched_a_schedule_type,
disclosure.fec_fitem_sched_a.increased_limit AS disclosure_fec_fitem_sched_a_increased_limit,
disclosure.fec_fitem_sched_a.sub_id AS disclosure_fec_fitem_sched_a_sub_id,
disclosure.fec_fitem_sched_a.pdf_url AS disclosure_fec_fitem_sched_a_pdf_url,
disclosure.fec_fitem_sched_a.line_number_label AS disclosure_fec_fitem_sched_a_line_number_label,
ofec_committee_history_mv_1.idx AS ofec_committee_history_mv_1_idx,
ofec_committee_history_mv_1.name AS ofec_committee_history_mv_1_name,
ofec_committee_history_mv_1.committee_id AS ofec_committee_history_mv_1_committee_id,
ofec_committee_history_mv_1.cycles AS ofec_committee_history_mv_1_cycles,
ofec_committee_history_mv_1.treasurer_name AS ofec_committee_history_mv_1_treasurer_name,
ofec_committee_history_mv_1.treasurer_text AS ofec_committee_history_mv_1_treasurer_text,
ofec_committee_history_mv_1.committee_type AS ofec_committee_history_mv_1_committee_type,
ofec_committee_history_mv_1.committee_type_full AS ofec_committee_history_mv_1_committee_type_full,
ofec_committee_history_mv_1.filing_frequency AS ofec_committee_history_mv_1_filing_frequency,
ofec_committee_history_mv_1.designation AS ofec_committee_history_mv_1_designation,
ofec_committee_history_mv_1.designation_full AS ofec_committee_history_mv_1_designation_full,
ofec_committee_history_mv_1.organization_type AS ofec_committee_history_mv_1_organization_type,
ofec_committee_history_mv_1.organization_type_full AS ofec_committee_history_mv_1_organization_type_full,
ofec_committee_history_mv_1.party AS ofec_committee_history_mv_1_party,
ofec_committee_history_mv_1.party_full AS ofec_committee_history_mv_1_party_full,
ofec_committee_history_mv_1.state AS ofec_committee_history_mv_1_state,
ofec_committee_history_mv_1.street_1 AS ofec_committee_history_mv_1_street_1,
ofec_committee_history_mv_1.street_2 AS ofec_committee_history_mv_1_street_2,
ofec_committee_history_mv_1.city AS ofec_committee_history_mv_1_city,
ofec_committee_history_mv_1.state_full AS ofec_committee_history_mv_1_state_full,
ofec_committee_history_mv_1.zip AS ofec_committee_history_mv_1_zip,
ofec_committee_history_mv_1.candidate_ids AS ofec_committee_history_mv_1_candidate_ids,
ofec_committee_history_mv_1.cycle AS ofec_committee_history_mv_1_cycle,
ofec_committee_history_mv_2.idx AS ofec_committee_history_mv_2_idx,
ofec_committee_history_mv_2.name AS ofec_committee_history_mv_2_name,
ofec_committee_history_mv_2.committee_id AS ofec_committee_history_mv_2_committee_id,
ofec_committee_history_mv_2.cycles AS ofec_committee_history_mv_2_cycles,
ofec_committee_history_mv_2.treasurer_name AS ofec_committee_history_mv_2_treasurer_name,
ofec_committee_history_mv_2.treasurer_text AS ofec_committee_history_mv_2_treasurer_text,
ofec_committee_history_mv_2.committee_type AS ofec_committee_history_mv_2_committee_type,
ofec_committee_history_mv_2.committee_type_full AS ofec_committee_history_mv_2_committee_type_full,
ofec_committee_history_mv_2.filing_frequency AS ofec_committee_history_mv_2_filing_frequency,
ofec_committee_history_mv_2.designation AS ofec_committee_history_mv_2_designation,
ofec_committee_history_mv_2.designation_full AS ofec_committee_history_mv_2_designation_full,
ofec_committee_history_mv_2.organization_type AS ofec_committee_history_mv_2_organization_type,
ofec_committee_history_mv_2.organization_type_full AS ofec_committee_history_mv_2_organization_type_full,
ofec_committee_history_mv_2.party AS ofec_committee_history_mv_2_party,
ofec_committee_history_mv_2.party_full AS ofec_committee_history_mv_2_party_full,
ofec_committee_history_mv_2.state AS ofec_committee_history_mv_2_state,
ofec_committee_history_mv_2.street_1 AS ofec_committee_history_mv_2_street_1,
ofec_committee_history_mv_2.street_2 AS ofec_committee_history_mv_2_street_2,
ofec_committee_history_mv_2.city AS ofec_committee_history_mv_2_city,
ofec_committee_history_mv_2.state_full AS ofec_committee_history_mv_2_state_full,
ofec_committee_history_mv_2.zip AS ofec_committee_history_mv_2_zip,
ofec_committee_history_mv_2.candidate_ids AS ofec_committee_history_mv_2_candidate_ids,
ofec_committee_history_mv_2.cycle AS ofec_committee_history_mv_2_cycle
FROM
disclosure.fec_fitem_sched_a
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_1 ON disclosure.fec_fitem_sched_a.clean_contbr_id = ofec_committee_history_mv_1.committee_id
AND disclosure.fec_fitem_sched_a.rpt_yr + disclosure.fec_fitem_sched_a.rpt_yr % 2 = ofec_committee_history_mv_1.cycle
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_2 ON disclosure.fec_fitem_sched_a.cmte_id = ofec_committee_history_mv_2.committee_id
AND disclosure.fec_fitem_sched_a.rpt_yr + disclosure.fec_fitem_sched_a.rpt_yr % 2 = ofec_committee_history_mv_2.cycle
WHERE
disclosure.fec_fitem_sched_a.two_year_transaction_period = 2016
AND disclosure.fec_fitem_sched_a.cmte_id IN ('C00401224')
AND disclosure.fec_fitem_sched_a.contb_receipt_dt >= '2015-05-16'::date
AND (COALESCE (disclosure.fec_fitem_sched_a.contb_receipt_dt, '9999-12-31'::date), disclosure.fec_fitem_sched_a.sub_id)
> ('2015-09-07'::date, 4021620161267723870)
ORDER BY
disclosure.fec_fitem_sched_a.contb_receipt_dt ASC,
disclosure.fec_fitem_sched_a.sub_id ASC
LIMIT 100;
The text was updated successfully, but these errors were encountered: