Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "UNION ALL+limit" for full 45 years SA search by using "two_year_transaction_period" #4414

Closed
1 task
dzhang-fec opened this issue Jun 15, 2020 · 8 comments · Fixed by #4802
Closed
1 task

Comments

@dzhang-fec
Copy link
Contributor

dzhang-fec commented Jun 15, 2020

Summary:
Code change for "All year Search" to "use partitions cluster index and "limit"" , in case of system crash by accumulated long sqls and even no any result to clients of 19 mins sql run. new sql 36 secs

Completion criteria:

  • Schedule A uses "union all" for two-year transaction periods instead of "or"

Problem:
Why we need to change this?

  1. run 19 mins that endUser got nothing and
  2. high risk to accumulate to cause system crash
    This is the top 1 slow sqls at production:
    image
    and we saw cpu spikes.

The exact sql code is
SELECT * 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.cmte_id = ofec_committee_history_mv_1.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = 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.clean_contbr_id = ofec_committee_history_mv_2.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = ofec_committee_history_mv_2.cycle
WHERE disclosure.fec_fitem_sched_a.is_individual = true
AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('ActBlue:*')
ORDER BY disclosure.fec_fitem_sched_a.contb_receipt_dt DESC, disclosure.fec_fitem_sched_a.sub_id DESC
LIMIT 30

Analysis and Suggestions:
Analysis:

The issue is searching for "all" yeas from 1975 to 2020 of schedule_a and the sql is not using our index at all. full table scan 332,757,433 rows. We have the partitions from 1975 (23 partitions now). I will be much better to use the fec_fitem_sched_a.two_year_transaction_period index as we are using for others sqls.
There is only 30 rows return but current it has to scan 332millions rows.

There is some ideas on this, but it may take more time before the election of this year.

Suggestions:

  1. For this kind of "ALL Years' search, add this in the sql disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020)
    This is to use the cluster index of the partitions we have now.

2)use "UNION all" to union all of the years, to keep the same sql return.

3)Code suggestion as below (but it needs code change).

Thanks for the review.

@dzhang-fec
Copy link
Contributor Author

@lbeaufort found a good one to do the join at end and only one time to reduce the code size. little bit of slower, but it is less than 1 time.

SELECT anon_2.anon_1_disclosure_fec_fitem_sched_a_cmte_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_rpt_yr, anon_2.anon_1_disclosure_fec_fitem_sched_a_rpt_tp, anon_2.anon_1_disclosure_fec_fitem_sched_a_image_num, anon_2.anon_1_disclosure_fec_fitem_sched_a_line_num, anon_2.anon_1_disclosure_fec_fitem_sched_a_tran_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_file_num, anon_2.anon_1_disclosure_fec_fitem_sched_a_cmte_nm, anon_2.anon_1_disclosure_fec_fitem_sched_a_entity_tp, anon_2.anon_1_disclosure_fec_fitem_sched_a_entity_tp_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_prefix, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_nm, anon_2.anon_1_disclosure_fec_fitem_sched_a_cmte_tp, anon_2.anon_1_disclosure_fec_fitem_sched_a_org_tp, anon_2.anon_1_disclosure_fec_fitem_sched_a_cmte_dsgn, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_nm_first, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_m_nm, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_nm_last, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_suffix, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_st1, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_st2, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_city, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_st, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_zip, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_employer, anon_2.anon_1_disclosure_fec_fitem_sched_a_contbr_occupation, anon_2.anon_1_disclosure_fec_fitem_sched_a_clean_contbr_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_receipt_tp, anon_2.anon_1_disclosure_fec_fitem_sched_a_receipt_tp_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_receipt_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_memo_cd, anon_2.anon_1_disclosure_fec_fitem_sched_a_memo_cd_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_contb_receipt_dt, anon_2.anon_1_disclosure_fec_fitem_sched_a_contb_receipt_amt, anon_2.anon_1_disclosure_fec_fitem_sched_a_contb_aggregate_ytd, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_nm, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_nm_first, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_nm_last, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_m_nm, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_prefix, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_suffix, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_office, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_office_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_office_st, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_office_st_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_cand_office_district, anon_2.anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_nm, anon_2.anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st1, anon_2.anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st2, anon_2.anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_city, anon_2.anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st, anon_2.anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_zip, anon_2.anon_1_disclosure_fec_fitem_sched_a_donor_cmte_nm, anon_2.anon_1_disclosure_fec_fitem_sched_a_national_cmte_nonfed__1, anon_2.anon_1_disclosure_fec_fitem_sched_a_election_tp, anon_2.anon_1_disclosure_fec_fitem_sched_a_election_tp_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_fec_election_tp_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_fec_election_yr, anon_2.anon_1_disclosure_fec_fitem_sched_a_action_cd, anon_2.anon_1_disclosure_fec_fitem_sched_a_action_cd_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_schedule_type_desc, anon_2.anon_1_disclosure_fec_fitem_sched_a_pg_date, anon_2.anon_1_disclosure_fec_fitem_sched_a_orig_sub_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_back_ref_tran_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_back_ref_sched_nm, anon_2.anon_1_disclosure_fec_fitem_sched_a_filing_form, anon_2.anon_1_disclosure_fec_fitem_sched_a_link_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_contributor_name_text, anon_2.anon_1_disclosure_fec_fitem_sched_a_contributor_employer__2, anon_2.anon_1_disclosure_fec_fitem_sched_a_contributor_occupatio_3, anon_2.anon_1_disclosure_fec_fitem_sched_a_is_individual, anon_2.anon_1_disclosure_fec_fitem_sched_a_memo_text, anon_2.anon_1_disclosure_fec_fitem_sched_a_two_year_transaction__4, anon_2.anon_1_disclosure_fec_fitem_sched_a_schedule_type, anon_2.anon_1_disclosure_fec_fitem_sched_a_increased_limit, anon_2.anon_1_disclosure_fec_fitem_sched_a_sub_id, anon_2.anon_1_disclosure_fec_fitem_sched_a_pdf_url, anon_2.anon_1_disclosure_fec_fitem_sched_a_line_number_label, ofec_committee_history_mv_1.idx, ofec_committee_history_mv_1.name, ofec_committee_history_mv_1.committee_id, ofec_committee_history_mv_1.cycles, ofec_committee_history_mv_1.treasurer_name, ofec_committee_history_mv_1.treasurer_text, ofec_committee_history_mv_1.committee_type, ofec_committee_history_mv_1.committee_type_full, ofec_committee_history_mv_1.filing_frequency, ofec_committee_history_mv_1.designation, ofec_committee_history_mv_1.designation_full, ofec_committee_history_mv_1.organization_type, ofec_committee_history_mv_1.organization_type_full, ofec_committee_history_mv_1.affiliated_committee_name, ofec_committee_history_mv_1.party, ofec_committee_history_mv_1.party_full, ofec_committee_history_mv_1.state, ofec_committee_history_mv_1.street_1, ofec_committee_history_mv_1.street_2, ofec_committee_history_mv_1.city, ofec_committee_history_mv_1.state_full, ofec_committee_history_mv_1.zip, ofec_committee_history_mv_1.candidate_ids, ofec_committee_history_mv_1.cycle, ofec_committee_history_mv_1.cycles_has_financial, ofec_committee_history_mv_1.last_cycle_has_financial, ofec_committee_history_mv_1.cycles_has_activity, ofec_committee_history_mv_1.last_cycle_has_activity, ofec_committee_history_mv_1.is_active, ofec_committee_history_mv_2.idx, ofec_committee_history_mv_2.name, ofec_committee_history_mv_2.committee_id, ofec_committee_history_mv_2.cycles, ofec_committee_history_mv_2.treasurer_name, ofec_committee_history_mv_2.treasurer_text, ofec_committee_history_mv_2.committee_type, ofec_committee_history_mv_2.committee_type_full, ofec_committee_history_mv_2.filing_frequency, ofec_committee_history_mv_2.designation, ofec_committee_history_mv_2.designation_full, ofec_committee_history_mv_2.organization_type, ofec_committee_history_mv_2.organization_type_full, ofec_committee_history_mv_2.affiliated_committee_name, ofec_committee_history_mv_2.party, ofec_committee_history_mv_2.party_full, ofec_committee_history_mv_2.state, ofec_committee_history_mv_2.street_1, ofec_committee_history_mv_2.street_2, ofec_committee_history_mv_2.city, ofec_committee_history_mv_2.state_full, ofec_committee_history_mv_2.zip, ofec_committee_history_mv_2.candidate_ids, ofec_committee_history_mv_2.cycle, ofec_committee_history_mv_2.cycles_has_financial, ofec_committee_history_mv_2.last_cycle_has_financial, ofec_committee_history_mv_2.cycles_has_activity, ofec_committee_history_mv_2.last_cycle_has_activity, ofec_committee_history_mv_2.is_active
FROM (SELECT anon_1.disclosure_fec_fitem_sched_a_cmte_id AS anon_1_disclosure_fec_fitem_sched_a_cmte_id, anon_1.disclosure_fec_fitem_sched_a_rpt_yr AS anon_1_disclosure_fec_fitem_sched_a_rpt_yr, anon_1.disclosure_fec_fitem_sched_a_rpt_tp AS anon_1_disclosure_fec_fitem_sched_a_rpt_tp, anon_1.disclosure_fec_fitem_sched_a_image_num AS anon_1_disclosure_fec_fitem_sched_a_image_num, anon_1.disclosure_fec_fitem_sched_a_line_num AS anon_1_disclosure_fec_fitem_sched_a_line_num, anon_1.disclosure_fec_fitem_sched_a_tran_id AS anon_1_disclosure_fec_fitem_sched_a_tran_id, anon_1.disclosure_fec_fitem_sched_a_file_num AS anon_1_disclosure_fec_fitem_sched_a_file_num, anon_1.disclosure_fec_fitem_sched_a_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_entity_tp AS anon_1_disclosure_fec_fitem_sched_a_entity_tp, anon_1.disclosure_fec_fitem_sched_a_entity_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_entity_tp_desc, anon_1.disclosure_fec_fitem_sched_a_contbr_id AS anon_1_disclosure_fec_fitem_sched_a_contbr_id, anon_1.disclosure_fec_fitem_sched_a_contbr_prefix AS anon_1_disclosure_fec_fitem_sched_a_contbr_prefix, anon_1.disclosure_fec_fitem_sched_a_contbr_nm AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm, anon_1.disclosure_fec_fitem_sched_a_cmte_tp AS anon_1_disclosure_fec_fitem_sched_a_cmte_tp, anon_1.disclosure_fec_fitem_sched_a_org_tp AS anon_1_disclosure_fec_fitem_sched_a_org_tp, anon_1.disclosure_fec_fitem_sched_a_cmte_dsgn AS anon_1_disclosure_fec_fitem_sched_a_cmte_dsgn, anon_1.disclosure_fec_fitem_sched_a_contbr_nm_first AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm_first, anon_1.disclosure_fec_fitem_sched_a_contbr_m_nm AS anon_1_disclosure_fec_fitem_sched_a_contbr_m_nm, anon_1.disclosure_fec_fitem_sched_a_contbr_nm_last AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm_last, anon_1.disclosure_fec_fitem_sched_a_contbr_suffix AS anon_1_disclosure_fec_fitem_sched_a_contbr_suffix, anon_1.disclosure_fec_fitem_sched_a_contbr_st1 AS anon_1_disclosure_fec_fitem_sched_a_contbr_st1, anon_1.disclosure_fec_fitem_sched_a_contbr_st2 AS anon_1_disclosure_fec_fitem_sched_a_contbr_st2, anon_1.disclosure_fec_fitem_sched_a_contbr_city AS anon_1_disclosure_fec_fitem_sched_a_contbr_city, anon_1.disclosure_fec_fitem_sched_a_contbr_st AS anon_1_disclosure_fec_fitem_sched_a_contbr_st, anon_1.disclosure_fec_fitem_sched_a_contbr_zip AS anon_1_disclosure_fec_fitem_sched_a_contbr_zip, anon_1.disclosure_fec_fitem_sched_a_contbr_employer AS anon_1_disclosure_fec_fitem_sched_a_contbr_employer, anon_1.disclosure_fec_fitem_sched_a_contbr_occupation AS anon_1_disclosure_fec_fitem_sched_a_contbr_occupation, anon_1.disclosure_fec_fitem_sched_a_clean_contbr_id AS anon_1_disclosure_fec_fitem_sched_a_clean_contbr_id, anon_1.disclosure_fec_fitem_sched_a_receipt_tp AS anon_1_disclosure_fec_fitem_sched_a_receipt_tp, anon_1.disclosure_fec_fitem_sched_a_receipt_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_receipt_tp_desc, anon_1.disclosure_fec_fitem_sched_a_receipt_desc AS anon_1_disclosure_fec_fitem_sched_a_receipt_desc, anon_1.disclosure_fec_fitem_sched_a_memo_cd AS anon_1_disclosure_fec_fitem_sched_a_memo_cd, anon_1.disclosure_fec_fitem_sched_a_memo_cd_desc AS anon_1_disclosure_fec_fitem_sched_a_memo_cd_desc, anon_1.disclosure_fec_fitem_sched_a_contb_receipt_dt AS anon_1_disclosure_fec_fitem_sched_a_contb_receipt_dt, anon_1.disclosure_fec_fitem_sched_a_contb_receipt_amt AS anon_1_disclosure_fec_fitem_sched_a_contb_receipt_amt, anon_1.disclosure_fec_fitem_sched_a_contb_aggregate_ytd AS anon_1_disclosure_fec_fitem_sched_a_contb_aggregate_ytd, anon_1.disclosure_fec_fitem_sched_a_cand_id AS anon_1_disclosure_fec_fitem_sched_a_cand_id, anon_1.disclosure_fec_fitem_sched_a_cand_nm AS anon_1_disclosure_fec_fitem_sched_a_cand_nm, anon_1.disclosure_fec_fitem_sched_a_cand_nm_first AS anon_1_disclosure_fec_fitem_sched_a_cand_nm_first, anon_1.disclosure_fec_fitem_sched_a_cand_nm_last AS anon_1_disclosure_fec_fitem_sched_a_cand_nm_last, anon_1.disclosure_fec_fitem_sched_a_cand_m_nm AS anon_1_disclosure_fec_fitem_sched_a_cand_m_nm, anon_1.disclosure_fec_fitem_sched_a_cand_prefix AS anon_1_disclosure_fec_fitem_sched_a_cand_prefix, anon_1.disclosure_fec_fitem_sched_a_cand_suffix AS anon_1_disclosure_fec_fitem_sched_a_cand_suffix, anon_1.disclosure_fec_fitem_sched_a_cand_office AS anon_1_disclosure_fec_fitem_sched_a_cand_office, anon_1.disclosure_fec_fitem_sched_a_cand_office_desc AS anon_1_disclosure_fec_fitem_sched_a_cand_office_desc, anon_1.disclosure_fec_fitem_sched_a_cand_office_st AS anon_1_disclosure_fec_fitem_sched_a_cand_office_st, anon_1.disclosure_fec_fitem_sched_a_cand_office_st_desc AS anon_1_disclosure_fec_fitem_sched_a_cand_office_st_desc, anon_1.disclosure_fec_fitem_sched_a_cand_office_district AS anon_1_disclosure_fec_fitem_sched_a_cand_office_district, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_id AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_id, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st1 AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st1, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st2 AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st2, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_city AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_city, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_zip AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_zip, anon_1.disclosure_fec_fitem_sched_a_donor_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_donor_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_national_cmte_nonfed_acct AS anon_1_disclosure_fec_fitem_sched_a_national_cmte_nonfed__1, anon_1.disclosure_fec_fitem_sched_a_election_tp AS anon_1_disclosure_fec_fitem_sched_a_election_tp, anon_1.disclosure_fec_fitem_sched_a_election_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_election_tp_desc, anon_1.disclosure_fec_fitem_sched_a_fec_election_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_fec_election_tp_desc, anon_1.disclosure_fec_fitem_sched_a_fec_election_yr AS anon_1_disclosure_fec_fitem_sched_a_fec_election_yr, anon_1.disclosure_fec_fitem_sched_a_action_cd AS anon_1_disclosure_fec_fitem_sched_a_action_cd, anon_1.disclosure_fec_fitem_sched_a_action_cd_desc AS anon_1_disclosure_fec_fitem_sched_a_action_cd_desc, anon_1.disclosure_fec_fitem_sched_a_schedule_type_desc AS anon_1_disclosure_fec_fitem_sched_a_schedule_type_desc, anon_1.disclosure_fec_fitem_sched_a_pg_date AS anon_1_disclosure_fec_fitem_sched_a_pg_date, anon_1.disclosure_fec_fitem_sched_a_orig_sub_id AS anon_1_disclosure_fec_fitem_sched_a_orig_sub_id, anon_1.disclosure_fec_fitem_sched_a_back_ref_tran_id AS anon_1_disclosure_fec_fitem_sched_a_back_ref_tran_id, anon_1.disclosure_fec_fitem_sched_a_back_ref_sched_nm AS anon_1_disclosure_fec_fitem_sched_a_back_ref_sched_nm, anon_1.disclosure_fec_fitem_sched_a_filing_form AS anon_1_disclosure_fec_fitem_sched_a_filing_form, anon_1.disclosure_fec_fitem_sched_a_link_id AS anon_1_disclosure_fec_fitem_sched_a_link_id, anon_1.disclosure_fec_fitem_sched_a_contributor_name_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_name_text, anon_1.disclosure_fec_fitem_sched_a_contributor_employer_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_employer__2, anon_1.disclosure_fec_fitem_sched_a_contributor_occupation_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_occupatio_3, anon_1.disclosure_fec_fitem_sched_a_is_individual AS anon_1_disclosure_fec_fitem_sched_a_is_individual, anon_1.disclosure_fec_fitem_sched_a_memo_text AS anon_1_disclosure_fec_fitem_sched_a_memo_text, anon_1.disclosure_fec_fitem_sched_a_two_year_transaction_period AS anon_1_disclosure_fec_fitem_sched_a_two_year_transaction__4, anon_1.disclosure_fec_fitem_sched_a_schedule_type AS anon_1_disclosure_fec_fitem_sched_a_schedule_type, anon_1.disclosure_fec_fitem_sched_a_increased_limit AS anon_1_disclosure_fec_fitem_sched_a_increased_limit, anon_1.disclosure_fec_fitem_sched_a_sub_id AS anon_1_disclosure_fec_fitem_sched_a_sub_id, anon_1.disclosure_fec_fitem_sched_a_pdf_url AS anon_1_disclosure_fec_fitem_sched_a_pdf_url, anon_1.disclosure_fec_fitem_sched_a_line_number_label AS anon_1_disclosure_fec_fitem_sched_a_line_number_label
FROM (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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00656314:') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00647701:
') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00664938:') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00667865:
')) AS anon_1
WHERE anon_1.disclosure_fec_fitem_sched_a_contributor_employer_text @@ to_tsquery('amazon:') UNION ALL SELECT anon_1.disclosure_fec_fitem_sched_a_cmte_id AS anon_1_disclosure_fec_fitem_sched_a_cmte_id, anon_1.disclosure_fec_fitem_sched_a_rpt_yr AS anon_1_disclosure_fec_fitem_sched_a_rpt_yr, anon_1.disclosure_fec_fitem_sched_a_rpt_tp AS anon_1_disclosure_fec_fitem_sched_a_rpt_tp, anon_1.disclosure_fec_fitem_sched_a_image_num AS anon_1_disclosure_fec_fitem_sched_a_image_num, anon_1.disclosure_fec_fitem_sched_a_line_num AS anon_1_disclosure_fec_fitem_sched_a_line_num, anon_1.disclosure_fec_fitem_sched_a_tran_id AS anon_1_disclosure_fec_fitem_sched_a_tran_id, anon_1.disclosure_fec_fitem_sched_a_file_num AS anon_1_disclosure_fec_fitem_sched_a_file_num, anon_1.disclosure_fec_fitem_sched_a_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_entity_tp AS anon_1_disclosure_fec_fitem_sched_a_entity_tp, anon_1.disclosure_fec_fitem_sched_a_entity_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_entity_tp_desc, anon_1.disclosure_fec_fitem_sched_a_contbr_id AS anon_1_disclosure_fec_fitem_sched_a_contbr_id, anon_1.disclosure_fec_fitem_sched_a_contbr_prefix AS anon_1_disclosure_fec_fitem_sched_a_contbr_prefix, anon_1.disclosure_fec_fitem_sched_a_contbr_nm AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm, anon_1.disclosure_fec_fitem_sched_a_cmte_tp AS anon_1_disclosure_fec_fitem_sched_a_cmte_tp, anon_1.disclosure_fec_fitem_sched_a_org_tp AS anon_1_disclosure_fec_fitem_sched_a_org_tp, anon_1.disclosure_fec_fitem_sched_a_cmte_dsgn AS anon_1_disclosure_fec_fitem_sched_a_cmte_dsgn, anon_1.disclosure_fec_fitem_sched_a_contbr_nm_first AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm_first, anon_1.disclosure_fec_fitem_sched_a_contbr_m_nm AS anon_1_disclosure_fec_fitem_sched_a_contbr_m_nm, anon_1.disclosure_fec_fitem_sched_a_contbr_nm_last AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm_last, anon_1.disclosure_fec_fitem_sched_a_contbr_suffix AS anon_1_disclosure_fec_fitem_sched_a_contbr_suffix, anon_1.disclosure_fec_fitem_sched_a_contbr_st1 AS anon_1_disclosure_fec_fitem_sched_a_contbr_st1, anon_1.disclosure_fec_fitem_sched_a_contbr_st2 AS anon_1_disclosure_fec_fitem_sched_a_contbr_st2, anon_1.disclosure_fec_fitem_sched_a_contbr_city AS anon_1_disclosure_fec_fitem_sched_a_contbr_city, anon_1.disclosure_fec_fitem_sched_a_contbr_st AS anon_1_disclosure_fec_fitem_sched_a_contbr_st, anon_1.disclosure_fec_fitem_sched_a_contbr_zip AS anon_1_disclosure_fec_fitem_sched_a_contbr_zip, anon_1.disclosure_fec_fitem_sched_a_contbr_employer AS anon_1_disclosure_fec_fitem_sched_a_contbr_employer, anon_1.disclosure_fec_fitem_sched_a_contbr_occupation AS anon_1_disclosure_fec_fitem_sched_a_contbr_occupation, anon_1.disclosure_fec_fitem_sched_a_clean_contbr_id AS anon_1_disclosure_fec_fitem_sched_a_clean_contbr_id, anon_1.disclosure_fec_fitem_sched_a_receipt_tp AS anon_1_disclosure_fec_fitem_sched_a_receipt_tp, anon_1.disclosure_fec_fitem_sched_a_receipt_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_receipt_tp_desc, anon_1.disclosure_fec_fitem_sched_a_receipt_desc AS anon_1_disclosure_fec_fitem_sched_a_receipt_desc, anon_1.disclosure_fec_fitem_sched_a_memo_cd AS anon_1_disclosure_fec_fitem_sched_a_memo_cd, anon_1.disclosure_fec_fitem_sched_a_memo_cd_desc AS anon_1_disclosure_fec_fitem_sched_a_memo_cd_desc, anon_1.disclosure_fec_fitem_sched_a_contb_receipt_dt AS anon_1_disclosure_fec_fitem_sched_a_contb_receipt_dt, anon_1.disclosure_fec_fitem_sched_a_contb_receipt_amt AS anon_1_disclosure_fec_fitem_sched_a_contb_receipt_amt, anon_1.disclosure_fec_fitem_sched_a_contb_aggregate_ytd AS anon_1_disclosure_fec_fitem_sched_a_contb_aggregate_ytd, anon_1.disclosure_fec_fitem_sched_a_cand_id AS anon_1_disclosure_fec_fitem_sched_a_cand_id, anon_1.disclosure_fec_fitem_sched_a_cand_nm AS anon_1_disclosure_fec_fitem_sched_a_cand_nm, anon_1.disclosure_fec_fitem_sched_a_cand_nm_first AS anon_1_disclosure_fec_fitem_sched_a_cand_nm_first, anon_1.disclosure_fec_fitem_sched_a_cand_nm_last AS anon_1_disclosure_fec_fitem_sched_a_cand_nm_last, anon_1.disclosure_fec_fitem_sched_a_cand_m_nm AS anon_1_disclosure_fec_fitem_sched_a_cand_m_nm, anon_1.disclosure_fec_fitem_sched_a_cand_prefix AS anon_1_disclosure_fec_fitem_sched_a_cand_prefix, anon_1.disclosure_fec_fitem_sched_a_cand_suffix AS anon_1_disclosure_fec_fitem_sched_a_cand_suffix, anon_1.disclosure_fec_fitem_sched_a_cand_office AS anon_1_disclosure_fec_fitem_sched_a_cand_office, anon_1.disclosure_fec_fitem_sched_a_cand_office_desc AS anon_1_disclosure_fec_fitem_sched_a_cand_office_desc, anon_1.disclosure_fec_fitem_sched_a_cand_office_st AS anon_1_disclosure_fec_fitem_sched_a_cand_office_st, anon_1.disclosure_fec_fitem_sched_a_cand_office_st_desc AS anon_1_disclosure_fec_fitem_sched_a_cand_office_st_desc, anon_1.disclosure_fec_fitem_sched_a_cand_office_district AS anon_1_disclosure_fec_fitem_sched_a_cand_office_district, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_id AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_id, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st1 AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st1, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st2 AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st2, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_city AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_city, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_zip AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_zip, anon_1.disclosure_fec_fitem_sched_a_donor_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_donor_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_national_cmte_nonfed_acct AS anon_1_disclosure_fec_fitem_sched_a_national_cmte_nonfed__1, anon_1.disclosure_fec_fitem_sched_a_election_tp AS anon_1_disclosure_fec_fitem_sched_a_election_tp, anon_1.disclosure_fec_fitem_sched_a_election_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_election_tp_desc, anon_1.disclosure_fec_fitem_sched_a_fec_election_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_fec_election_tp_desc, anon_1.disclosure_fec_fitem_sched_a_fec_election_yr AS anon_1_disclosure_fec_fitem_sched_a_fec_election_yr, anon_1.disclosure_fec_fitem_sched_a_action_cd AS anon_1_disclosure_fec_fitem_sched_a_action_cd, anon_1.disclosure_fec_fitem_sched_a_action_cd_desc AS anon_1_disclosure_fec_fitem_sched_a_action_cd_desc, anon_1.disclosure_fec_fitem_sched_a_schedule_type_desc AS anon_1_disclosure_fec_fitem_sched_a_schedule_type_desc, anon_1.disclosure_fec_fitem_sched_a_pg_date AS anon_1_disclosure_fec_fitem_sched_a_pg_date, anon_1.disclosure_fec_fitem_sched_a_orig_sub_id AS anon_1_disclosure_fec_fitem_sched_a_orig_sub_id, anon_1.disclosure_fec_fitem_sched_a_back_ref_tran_id AS anon_1_disclosure_fec_fitem_sched_a_back_ref_tran_id, anon_1.disclosure_fec_fitem_sched_a_back_ref_sched_nm AS anon_1_disclosure_fec_fitem_sched_a_back_ref_sched_nm, anon_1.disclosure_fec_fitem_sched_a_filing_form AS anon_1_disclosure_fec_fitem_sched_a_filing_form, anon_1.disclosure_fec_fitem_sched_a_link_id AS anon_1_disclosure_fec_fitem_sched_a_link_id, anon_1.disclosure_fec_fitem_sched_a_contributor_name_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_name_text, anon_1.disclosure_fec_fitem_sched_a_contributor_employer_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_employer__2, anon_1.disclosure_fec_fitem_sched_a_contributor_occupation_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_occupatio_3, anon_1.disclosure_fec_fitem_sched_a_is_individual AS anon_1_disclosure_fec_fitem_sched_a_is_individual, anon_1.disclosure_fec_fitem_sched_a_memo_text AS anon_1_disclosure_fec_fitem_sched_a_memo_text, anon_1.disclosure_fec_fitem_sched_a_two_year_transaction_period AS anon_1_disclosure_fec_fitem_sched_a_two_year_transaction__4, anon_1.disclosure_fec_fitem_sched_a_schedule_type AS anon_1_disclosure_fec_fitem_sched_a_schedule_type, anon_1.disclosure_fec_fitem_sched_a_increased_limit AS anon_1_disclosure_fec_fitem_sched_a_increased_limit, anon_1.disclosure_fec_fitem_sched_a_sub_id AS anon_1_disclosure_fec_fitem_sched_a_sub_id, anon_1.disclosure_fec_fitem_sched_a_pdf_url AS anon_1_disclosure_fec_fitem_sched_a_pdf_url, anon_1.disclosure_fec_fitem_sched_a_line_number_label AS anon_1_disclosure_fec_fitem_sched_a_line_number_label
FROM (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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00656314:
') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00647701:') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00664938:
') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00667865:')) AS anon_1
WHERE anon_1.disclosure_fec_fitem_sched_a_contributor_employer_text @@ to_tsquery('google:
') UNION ALL SELECT anon_1.disclosure_fec_fitem_sched_a_cmte_id AS anon_1_disclosure_fec_fitem_sched_a_cmte_id, anon_1.disclosure_fec_fitem_sched_a_rpt_yr AS anon_1_disclosure_fec_fitem_sched_a_rpt_yr, anon_1.disclosure_fec_fitem_sched_a_rpt_tp AS anon_1_disclosure_fec_fitem_sched_a_rpt_tp, anon_1.disclosure_fec_fitem_sched_a_image_num AS anon_1_disclosure_fec_fitem_sched_a_image_num, anon_1.disclosure_fec_fitem_sched_a_line_num AS anon_1_disclosure_fec_fitem_sched_a_line_num, anon_1.disclosure_fec_fitem_sched_a_tran_id AS anon_1_disclosure_fec_fitem_sched_a_tran_id, anon_1.disclosure_fec_fitem_sched_a_file_num AS anon_1_disclosure_fec_fitem_sched_a_file_num, anon_1.disclosure_fec_fitem_sched_a_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_entity_tp AS anon_1_disclosure_fec_fitem_sched_a_entity_tp, anon_1.disclosure_fec_fitem_sched_a_entity_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_entity_tp_desc, anon_1.disclosure_fec_fitem_sched_a_contbr_id AS anon_1_disclosure_fec_fitem_sched_a_contbr_id, anon_1.disclosure_fec_fitem_sched_a_contbr_prefix AS anon_1_disclosure_fec_fitem_sched_a_contbr_prefix, anon_1.disclosure_fec_fitem_sched_a_contbr_nm AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm, anon_1.disclosure_fec_fitem_sched_a_cmte_tp AS anon_1_disclosure_fec_fitem_sched_a_cmte_tp, anon_1.disclosure_fec_fitem_sched_a_org_tp AS anon_1_disclosure_fec_fitem_sched_a_org_tp, anon_1.disclosure_fec_fitem_sched_a_cmte_dsgn AS anon_1_disclosure_fec_fitem_sched_a_cmte_dsgn, anon_1.disclosure_fec_fitem_sched_a_contbr_nm_first AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm_first, anon_1.disclosure_fec_fitem_sched_a_contbr_m_nm AS anon_1_disclosure_fec_fitem_sched_a_contbr_m_nm, anon_1.disclosure_fec_fitem_sched_a_contbr_nm_last AS anon_1_disclosure_fec_fitem_sched_a_contbr_nm_last, anon_1.disclosure_fec_fitem_sched_a_contbr_suffix AS anon_1_disclosure_fec_fitem_sched_a_contbr_suffix, anon_1.disclosure_fec_fitem_sched_a_contbr_st1 AS anon_1_disclosure_fec_fitem_sched_a_contbr_st1, anon_1.disclosure_fec_fitem_sched_a_contbr_st2 AS anon_1_disclosure_fec_fitem_sched_a_contbr_st2, anon_1.disclosure_fec_fitem_sched_a_contbr_city AS anon_1_disclosure_fec_fitem_sched_a_contbr_city, anon_1.disclosure_fec_fitem_sched_a_contbr_st AS anon_1_disclosure_fec_fitem_sched_a_contbr_st, anon_1.disclosure_fec_fitem_sched_a_contbr_zip AS anon_1_disclosure_fec_fitem_sched_a_contbr_zip, anon_1.disclosure_fec_fitem_sched_a_contbr_employer AS anon_1_disclosure_fec_fitem_sched_a_contbr_employer, anon_1.disclosure_fec_fitem_sched_a_contbr_occupation AS anon_1_disclosure_fec_fitem_sched_a_contbr_occupation, anon_1.disclosure_fec_fitem_sched_a_clean_contbr_id AS anon_1_disclosure_fec_fitem_sched_a_clean_contbr_id, anon_1.disclosure_fec_fitem_sched_a_receipt_tp AS anon_1_disclosure_fec_fitem_sched_a_receipt_tp, anon_1.disclosure_fec_fitem_sched_a_receipt_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_receipt_tp_desc, anon_1.disclosure_fec_fitem_sched_a_receipt_desc AS anon_1_disclosure_fec_fitem_sched_a_receipt_desc, anon_1.disclosure_fec_fitem_sched_a_memo_cd AS anon_1_disclosure_fec_fitem_sched_a_memo_cd, anon_1.disclosure_fec_fitem_sched_a_memo_cd_desc AS anon_1_disclosure_fec_fitem_sched_a_memo_cd_desc, anon_1.disclosure_fec_fitem_sched_a_contb_receipt_dt AS anon_1_disclosure_fec_fitem_sched_a_contb_receipt_dt, anon_1.disclosure_fec_fitem_sched_a_contb_receipt_amt AS anon_1_disclosure_fec_fitem_sched_a_contb_receipt_amt, anon_1.disclosure_fec_fitem_sched_a_contb_aggregate_ytd AS anon_1_disclosure_fec_fitem_sched_a_contb_aggregate_ytd, anon_1.disclosure_fec_fitem_sched_a_cand_id AS anon_1_disclosure_fec_fitem_sched_a_cand_id, anon_1.disclosure_fec_fitem_sched_a_cand_nm AS anon_1_disclosure_fec_fitem_sched_a_cand_nm, anon_1.disclosure_fec_fitem_sched_a_cand_nm_first AS anon_1_disclosure_fec_fitem_sched_a_cand_nm_first, anon_1.disclosure_fec_fitem_sched_a_cand_nm_last AS anon_1_disclosure_fec_fitem_sched_a_cand_nm_last, anon_1.disclosure_fec_fitem_sched_a_cand_m_nm AS anon_1_disclosure_fec_fitem_sched_a_cand_m_nm, anon_1.disclosure_fec_fitem_sched_a_cand_prefix AS anon_1_disclosure_fec_fitem_sched_a_cand_prefix, anon_1.disclosure_fec_fitem_sched_a_cand_suffix AS anon_1_disclosure_fec_fitem_sched_a_cand_suffix, anon_1.disclosure_fec_fitem_sched_a_cand_office AS anon_1_disclosure_fec_fitem_sched_a_cand_office, anon_1.disclosure_fec_fitem_sched_a_cand_office_desc AS anon_1_disclosure_fec_fitem_sched_a_cand_office_desc, anon_1.disclosure_fec_fitem_sched_a_cand_office_st AS anon_1_disclosure_fec_fitem_sched_a_cand_office_st, anon_1.disclosure_fec_fitem_sched_a_cand_office_st_desc AS anon_1_disclosure_fec_fitem_sched_a_cand_office_st_desc, anon_1.disclosure_fec_fitem_sched_a_cand_office_district AS anon_1_disclosure_fec_fitem_sched_a_cand_office_district, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_id AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_id, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st1 AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st1, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st2 AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st2, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_city AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_city, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_st AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_st, anon_1.disclosure_fec_fitem_sched_a_conduit_cmte_zip AS anon_1_disclosure_fec_fitem_sched_a_conduit_cmte_zip, anon_1.disclosure_fec_fitem_sched_a_donor_cmte_nm AS anon_1_disclosure_fec_fitem_sched_a_donor_cmte_nm, anon_1.disclosure_fec_fitem_sched_a_national_cmte_nonfed_acct AS anon_1_disclosure_fec_fitem_sched_a_national_cmte_nonfed__1, anon_1.disclosure_fec_fitem_sched_a_election_tp AS anon_1_disclosure_fec_fitem_sched_a_election_tp, anon_1.disclosure_fec_fitem_sched_a_election_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_election_tp_desc, anon_1.disclosure_fec_fitem_sched_a_fec_election_tp_desc AS anon_1_disclosure_fec_fitem_sched_a_fec_election_tp_desc, anon_1.disclosure_fec_fitem_sched_a_fec_election_yr AS anon_1_disclosure_fec_fitem_sched_a_fec_election_yr, anon_1.disclosure_fec_fitem_sched_a_action_cd AS anon_1_disclosure_fec_fitem_sched_a_action_cd, anon_1.disclosure_fec_fitem_sched_a_action_cd_desc AS anon_1_disclosure_fec_fitem_sched_a_action_cd_desc, anon_1.disclosure_fec_fitem_sched_a_schedule_type_desc AS anon_1_disclosure_fec_fitem_sched_a_schedule_type_desc, anon_1.disclosure_fec_fitem_sched_a_pg_date AS anon_1_disclosure_fec_fitem_sched_a_pg_date, anon_1.disclosure_fec_fitem_sched_a_orig_sub_id AS anon_1_disclosure_fec_fitem_sched_a_orig_sub_id, anon_1.disclosure_fec_fitem_sched_a_back_ref_tran_id AS anon_1_disclosure_fec_fitem_sched_a_back_ref_tran_id, anon_1.disclosure_fec_fitem_sched_a_back_ref_sched_nm AS anon_1_disclosure_fec_fitem_sched_a_back_ref_sched_nm, anon_1.disclosure_fec_fitem_sched_a_filing_form AS anon_1_disclosure_fec_fitem_sched_a_filing_form, anon_1.disclosure_fec_fitem_sched_a_link_id AS anon_1_disclosure_fec_fitem_sched_a_link_id, anon_1.disclosure_fec_fitem_sched_a_contributor_name_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_name_text, anon_1.disclosure_fec_fitem_sched_a_contributor_employer_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_employer__2, anon_1.disclosure_fec_fitem_sched_a_contributor_occupation_text AS anon_1_disclosure_fec_fitem_sched_a_contributor_occupatio_3, anon_1.disclosure_fec_fitem_sched_a_is_individual AS anon_1_disclosure_fec_fitem_sched_a_is_individual, anon_1.disclosure_fec_fitem_sched_a_memo_text AS anon_1_disclosure_fec_fitem_sched_a_memo_text, anon_1.disclosure_fec_fitem_sched_a_two_year_transaction_period AS anon_1_disclosure_fec_fitem_sched_a_two_year_transaction__4, anon_1.disclosure_fec_fitem_sched_a_schedule_type AS anon_1_disclosure_fec_fitem_sched_a_schedule_type, anon_1.disclosure_fec_fitem_sched_a_increased_limit AS anon_1_disclosure_fec_fitem_sched_a_increased_limit, anon_1.disclosure_fec_fitem_sched_a_sub_id AS anon_1_disclosure_fec_fitem_sched_a_sub_id, anon_1.disclosure_fec_fitem_sched_a_pdf_url AS anon_1_disclosure_fec_fitem_sched_a_pdf_url, anon_1.disclosure_fec_fitem_sched_a_line_number_label AS anon_1_disclosure_fec_fitem_sched_a_line_number_label
FROM (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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00656314:') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00647701:
') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00664938:') UNION ALL 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.cmte_tp AS disclosure_fec_fitem_sched_a_cmte_tp, disclosure.fec_fitem_sched_a.org_tp AS disclosure_fec_fitem_sched_a_org_tp, disclosure.fec_fitem_sched_a.cmte_dsgn AS disclosure_fec_fitem_sched_a_cmte_dsgn, 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
FROM disclosure.fec_fitem_sched_a
WHERE disclosure.fec_fitem_sched_a.two_year_transaction_period IN (2020) AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('C00667865:
')) AS anon_1
WHERE anon_1.disclosure_fec_fitem_sched_a_contributor_employer_text @@ to_tsquery('facebook:*')) AS anon_2
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_1
ON anon_2.anon_1_disclosure_fec_fitem_sched_a_cmte_id = ofec_committee_history_mv_1.committee_id
AND anon_2.anon_1_disclosure_fec_fitem_sched_a_two_year_transaction__4 = ofec_committee_history_mv_1.cycle
LEFT OUTER JOIN ofec_committee_history_mv AS ofec_committee_history_mv_2 ON anon_2.anon_1_disclosure_fec_fitem_sched_a_clean_contbr_id = ofec_committee_history_mv_2.committee_id AND anon_2.anon_1_disclosure_fec_fitem_sched_a_two_year_transaction__4 = ofec_committee_history_mv_2.cycle
ORDER BY anon_2.anon_1_disclosure_fec_fitem_sched_a_contb_receipt_dt DESC, anon_2.anon_1_disclosure_fec_fitem_sched_a_sub_id DESC
LIMIT 100

@dzhang-fec
Copy link
Contributor Author

dzhang-fec commented Jun 17, 2020

Execution plan "before change", cost is 31550196.55. about 400 times slower than "after" one)
"Limit (cost=31550196.55..31550196.62 rows=30 width=2967)"
" -> Sort (cost=31550196.55..31595998.39 rows=18320737 width=2967)"
" Sort Key: fec_fitem_sched_a.contb_receipt_dt DESC, fec_fitem_sched_a.sub_id DESC"
" -> Gather (cost=123449.05..31009103.60 rows=18320737 width=2967)"
" Workers Planned: 2"
" -> Hash Left Join (cost=122449.05..29176029.90 rows=7633640 width=2967)"
" Hash Cond: (((fec_fitem_sched_a.cmte_id)::text = (ofec_committee_history_mv_1.committee_id)::text) AND (fec_fitem_sched_a.two_year_transaction_period = ofec_committee_history_mv_1.cycle))"
" -> Hash Left Join (cost=61224.53..23480327.53 rows=7633640 width=2195)"
" Hash Cond: (((fec_fitem_sched_a.clean_contbr_id)::text = (ofec_committee_history_mv_2.committee_id)::text) AND (fec_fitem_sched_a.two_year_transaction_period = ofec_committee_history_mv_2.cycle))"
" -> Append (cost=0.00..19214628.89 rows=7633996 width=1445)"
" -> Parallel Seq Scan on fec_fitem_sched_a (cost=0.00..0.00 rows=1 width=5707)"
" Filter: (is_individual AND (contributor_name_text @@ to_tsquery('ActBlue:'::text)))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1975_1976 (cost=10.25..12.41 rows=1 width=3657)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1975_1976_contrib_name_text_amt_sub_id (cost=0.00..10.25 rows=1 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1977_1978 (cost=12.61..111.54 rows=19 width=3540)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1977_1978_contrib_name_text_amt_sub_id (cost=0.00..12.60 rows=47 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1979_1980 (cost=14.73..145.21 rows=25 width=3703)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1979_1980_contrib_name_text_amt_sub_id (cost=0.00..14.71 rows=62 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1981_1982 (cost=12.49..79.75 rows=15 width=3695)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1981_1982_contrib_name_text_amt_sub_id (cost=0.00..12.49 rows=32 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1983_1984 (cost=12.53..90.41 rows=19 width=3695)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1983_1984_contrib_name_text_amt_sub_id (cost=0.00..12.53 rows=37 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1985_1986 (cost=12.55..92.55 rows=21 width=3696)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1985_1986_contrib_name_text_amt_sub_id (cost=0.00..12.54 rows=38 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1987_1988 (cost=14.70..136.77 rows=32 width=3670)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1987_1988_contrib_name_text_amt_sub_id (cost=0.00..14.68 rows=58 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1989_1990 (cost=14.81..166.38 rows=41 width=3695)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1989_1990_contrib_name_text_amt_sub_id (cost=0.00..14.79 rows=72 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1991_1992 (cost=15.17..263.53 rows=68 width=3691)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1991_1992_contrib_name_text_amt_sub_id (cost=0.00..15.14 rows=118 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1993_1994 (cost=15.01..221.60 rows=56 width=3660)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1993_1994_contrib_name_text_amt_sub_id (cost=0.00..14.98 rows=98 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1995_1996 (cost=15.52..362.82 rows=94 width=3660)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1995_1996_contrib_name_text_amt_sub_id (cost=0.00..15.48 rows=165 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1997_1998 (cost=15.30..299.49 rows=78 width=3663)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1997_1998_contrib_name_text_amt_sub_id (cost=0.00..15.27 rows=135 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_1999_2000 (cost=16.00..491.79 rows=130 width=3583)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_1999_2000_contrib_name_text_amt_sub_id (cost=0.00..15.95 rows=226 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2001_2002 (cost=15.74..420.16 rows=110 width=2795)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2001_2002_contrib_name_text_amt_sub_id (cost=0.00..15.69 rows=192 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2003_2004 (cost=23.31..1948.81 rows=506 width=1618)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2003_2004_contrib_name_text_amt_sub_id (cost=0.00..23.09 rows=912 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2005_2006 (cost=110.16..21668.44 rows=4251 width=1560)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2005_2006_contrib_name_text_amt_sub_id (cost=0.00..107.61 rows=11115 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2007_2008 (cost=552.01..113887.27 rows=24852 width=1522)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2007_2008_contrib_name_text_dt_sub_id (cost=0.00..537.10 rows=63046 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2009_2010 (cost=611.37..121717.07 rows=27117 width=1541)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2009_2010_contrib_name_text_amt_sub_id (cost=0.00..595.10 rows=70246 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2011_2012 (cost=4044.24..637086.08 rows=173936 width=1440)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2011_2012_contrib_name_text_amt_sub_id (cost=0.00..3939.88 rows=443951 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2013_2014 (cost=10105.12..1281861.99 rows=452289 width=1421)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2013_2014_contrib_name_text_amt_sub_id (cost=0.00..9833.75 rows=1191933 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2015_2016 (cost=38600.30..4055314.79 rows=1697608 width=1483)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2015_2016_contrib_name_text_amt_sub_id (cost=0.00..37581.74 rows=4528465 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2017_2018 (cost=46032.20..5527207.32 rows=2068079 width=1474)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2017_2018_contrib_name_text_amt_sub_id (cost=0.00..44791.35 rows=5399880 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:'::text))"
" -> Parallel Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 (cost=72472.77..7451042.73 rows=3184648 width=1407)"
" Recheck Cond: (contributor_name_text @@ to_tsquery('ActBlue:
'::text))"
" Filter: is_individual"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..70561.98 rows=8489564 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('ActBlue:*'::text))"
" -> Hash (cost=34597.61..34597.61 rows=242661 width=752)"
" -> Seq Scan on ofec_committee_history_mv ofec_committee_history_mv_2 (cost=0.00..34597.61 rows=242661 width=752)"
" -> Hash (cost=34597.61..34597.61 rows=242661 width=752)"
" -> Seq Scan on ofec_committee_history_mv ofec_committee_history_mv_1 (cost=0.00..34597.61 rows=242661 width=752)"

@dzhang-fec
Copy link
Contributor Author

Execution plan "after" code change, cost about 22533.85
"Limit (cost=22533.85..22534.10 rows=100 width=2617)"
" -> Sort (cost=22533.85..22534.25 rows=160 width=2617)"
" Sort Key: fec_fitem_sched_a.contb_receipt_dt DESC, fec_fitem_sched_a.sub_id DESC"
" -> Nested Loop Left Join (cost=0.84..22527.99 rows=160 width=2617)"
" -> Nested Loop Left Join (cost=0.42..21827.99 rows=160 width=2168)"
" -> Append (cost=0.00..21127.99 rows=160 width=1727)"
" -> Append (cost=0.00..7850.27 rows=64 width=1673)"
" -> Append (cost=0.00..1962.41 rows=16 width=1673)"
" -> Seq Scan on fec_fitem_sched_a (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00656314:'::text)) AND (contributor_employer_text @@ to_tsquery('amazon:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 (cost=1924.66..1962.41 rows=15 width=1407)"
" Recheck Cond: ((contributor_name_text @@ to_tsquery('C00656314:'::text)) AND (contributor_employer_text @@ to_tsquery('amazon:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1924.66..1924.66 rows=15 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00656314:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..1148.68 rows=116057 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('amazon:'::text))"
" -> Append (cost=0.00..1962.41 rows=16 width=1673)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_1 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00647701:'::text)) AND (contributor_employer_text @@ to_tsquery('amazon:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_1 (cost=1924.66..1962.41 rows=15 width=1407)"
" Recheck Cond: ((contributor_name_text @@ to_tsquery('C00647701:'::text)) AND (contributor_employer_text @@ to_tsquery('amazon:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1924.66..1924.66 rows=15 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00647701:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..1148.68 rows=116057 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('amazon:'::text))"
" -> Append (cost=0.00..1962.41 rows=16 width=1673)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_2 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00664938:'::text)) AND (contributor_employer_text @@ to_tsquery('amazon:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_2 (cost=1924.66..1962.41 rows=15 width=1407)"
" Recheck Cond: ((contributor_name_text @@ to_tsquery('C00664938:'::text)) AND (contributor_employer_text @@ to_tsquery('amazon:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1924.66..1924.66 rows=15 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00664938:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..1148.68 rows=116057 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('amazon:'::text))"
" -> Append (cost=0.00..1962.41 rows=16 width=1673)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_3 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00667865:'::text)) AND (contributor_employer_text @@ to_tsquery('amazon:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_3 (cost=1924.66..1962.41 rows=15 width=1407)"
" Recheck Cond: ((contributor_name_text @@ to_tsquery('C00667865:'::text)) AND (contributor_employer_text @@ to_tsquery('amazon:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1924.66..1924.66 rows=15 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00667865:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..1148.68 rows=116057 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('amazon:'::text))"
" -> Append (cost=0.00..7635.31 rows=64 width=1673)"
" -> Append (cost=0.00..1908.67 rows=16 width=1673)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_4 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00656314:'::text)) AND (contributor_employer_text @@ to_tsquery('google:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_4 (cost=1870.93..1908.67 rows=15 width=1407)"
" Recheck Cond: ((contributor_name_text @@ to_tsquery('C00656314:'::text)) AND (contributor_employer_text @@ to_tsquery('google:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1870.93..1870.93 rows=15 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00656314:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..1094.94 rows=109425 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('google:'::text))"
" -> Append (cost=0.00..1908.67 rows=16 width=1673)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_5 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00647701:'::text)) AND (contributor_employer_text @@ to_tsquery('google:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_5 (cost=1870.93..1908.67 rows=15 width=1407)"
" Recheck Cond: ((contributor_name_text @@ to_tsquery('C00647701:'::text)) AND (contributor_employer_text @@ to_tsquery('google:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1870.93..1870.93 rows=15 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00647701:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..1094.94 rows=109425 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('google:'::text))"
" -> Append (cost=0.00..1908.67 rows=16 width=1673)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_6 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00664938:'::text)) AND (contributor_employer_text @@ to_tsquery('google:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_6 (cost=1870.93..1908.67 rows=15 width=1407)"
" Recheck Cond: ((contributor_name_text @@ to_tsquery('C00664938:'::text)) AND (contributor_employer_text @@ to_tsquery('google:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1870.93..1870.93 rows=15 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00664938:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..1094.94 rows=109425 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('google:'::text))"
" -> Append (cost=0.00..1908.67 rows=16 width=1673)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_7 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00667865:'::text)) AND (contributor_employer_text @@ to_tsquery('google:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_7 (cost=1870.93..1908.67 rows=15 width=1407)"
" Recheck Cond: ((contributor_name_text @@ to_tsquery('C00667865:'::text)) AND (contributor_employer_text @@ to_tsquery('google:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1870.93..1870.93 rows=15 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00667865:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..1094.94 rows=109425 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('google:'::text))"
" -> Append (cost=0.00..5640.81 rows=32 width=1945)"
" -> Append (cost=0.00..1410.12 rows=8 width=1945)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_8 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00656314:'::text)) AND (contributor_employer_text @@ to_tsquery('facebook:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_8 (cost=1392.51..1410.12 rows=7 width=1407)"
" Recheck Cond: ((contributor_employer_text @@ to_tsquery('facebook:
'::text)) AND (contributor_name_text @@ to_tsquery('C00656314:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1392.51..1392.51 rows=7 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..616.53 rows=50970 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('facebook:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00656314:'::text))"
" -> Append (cost=0.00..1410.12 rows=8 width=1945)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_9 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00647701:'::text)) AND (contributor_employer_text @@ to_tsquery('facebook:
'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_9 (cost=1392.51..1410.12 rows=7 width=1407)"
" Recheck Cond: ((contributor_employer_text @@ to_tsquery('facebook:'::text)) AND (contributor_name_text @@ to_tsquery('C00647701:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1392.51..1392.51 rows=7 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..616.53 rows=50970 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('facebook:
'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00647701:'::text))"
" -> Append (cost=0.00..1410.12 rows=8 width=1945)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_10 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00664938:'::text)) AND (contributor_employer_text @@ to_tsquery('facebook:'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_10 (cost=1392.51..1410.12 rows=7 width=1407)"
" Recheck Cond: ((contributor_employer_text @@ to_tsquery('facebook:
'::text)) AND (contributor_name_text @@ to_tsquery('C00664938:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1392.51..1392.51 rows=7 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..616.53 rows=50970 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('facebook:'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00664938:'::text))"
" -> Append (cost=0.00..1410.12 rows=8 width=1945)"
" -> Seq Scan on fec_fitem_sched_a fec_fitem_sched_a_11 (cost=0.00..0.00 rows=1 width=5707)"
" Filter: ((two_year_transaction_period = '2020'::numeric) AND (contributor_name_text @@ to_tsquery('C00667865:'::text)) AND (contributor_employer_text @@ to_tsquery('facebook:
'::text)))"
" -> Bitmap Heap Scan on fec_fitem_sched_a_2019_2020 fec_fitem_sched_a_2019_2020_11 (cost=1392.51..1410.12 rows=7 width=1407)"
" Recheck Cond: ((contributor_employer_text @@ to_tsquery('facebook:'::text)) AND (contributor_name_text @@ to_tsquery('C00667865:'::text)))"
" Filter: (two_year_transaction_period = '2020'::numeric)"
" -> BitmapAnd (cost=1392.51..1392.51 rows=7 width=0)"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_emp_text_amt_sub_id (cost=0.00..616.53 rows=50970 width=0)"
" Index Cond: (contributor_employer_text @@ to_tsquery('facebook:
'::text))"
" -> Bitmap Index Scan on idx_sched_a_2019_2020_contrib_name_text_amt_sub_id (cost=0.00..775.73 rows=13264 width=0)"
" Index Cond: (contributor_name_text @@ to_tsquery('C00667865:'::text))"
" -> Index Scan using idx_ofec_committee_history_mv_cycle_committee_id on ofec_committee_history_mv ofec_committee_history_mv_1 (cost=0.42..4.37 rows=1 width=449)"
" Index Cond: ((fec_fitem_sched_a.two_year_transaction_period = cycle) AND ((fec_fitem_sched_a.cmte_id)::text = (committee_id)::text))"
" -> Index Scan using idx_ofec_committee_history_mv_cycle_committee_id on ofec_committee_history_mv ofec_committee_history_mv_2 (cost=0.42..4.37 rows=1 width=449)"
" Index Cond: ((fec_fitem_sched_a.two_year_transaction_period = cycle) AND ((fec_fitem_sched_a.clean_contbr_id)::text = (committee_id)::text))"

@dzhang-fec dzhang-fec changed the title Improve slowest queries by code change: 19mins to 2.6 sec, 450 times faster Improve slowest queries by code change ("use partitions cluster index and "limit"): 19mins to 2.6 sec, 450 times faster Jun 22, 2020
@lbeaufort
Copy link
Member

@dzhang-fec would we get a similar benefit if we appended the two_year_transaction_period values as ORs? That would be a much smaller code change we could implement as a first step.

@dzhang-fec
Copy link
Contributor Author

dzhang-fec commented Jun 25, 2020

@lbeaufort Yes, they are very similar. Basically, we want use
Yes, UNION all is better for 'OR" in postgres for large dataset.
1)union all (not OR, for multiple same filters on full search on name and cmt_id etc)
2)limit x is it has limit at the end, and
3)if "all" year, use UNION ALL

And
For "all year" search, I tested the followings:

  1. is in (1976, 1978,... 2020) still very slow (xx mins)
  2. .. or, e,g id =1976 or id =1978 ...or id =2020) still very slow (xx mins)
    3)union all very fast (2 secs to 19 secs)
    Thanks!

@lbeaufort lbeaufort self-assigned this Jul 19, 2020
@lbeaufort lbeaufort changed the title Improve slowest queries by code change ("use partitions cluster index and "limit"): 19mins to 2.6 sec, 450 times faster Use "UNION ALL" for "two_year_transaction_period" Jul 20, 2020
@dzhang-fec dzhang-fec changed the title Use "UNION ALL" for "two_year_transaction_period" Use "UNION ALL+limit" for full 45 years SA search by using "two_year_transaction_period" Jul 20, 2020
@lbeaufort lbeaufort modified the milestones: Sprint 13.1, Sprint 13.2 Jul 21, 2020
@lbeaufort lbeaufort removed their assignment Aug 14, 2020
@lbeaufort lbeaufort modified the milestones: Sprint 13.2, Sprint 13.4 Aug 14, 2020
@patphongs patphongs modified the milestones: Sprint 13.4, Sprint 13.5 Aug 31, 2020
@lbeaufort lbeaufort self-assigned this Sep 15, 2020
@fec-jli
Copy link
Contributor

fec-jli commented Sep 29, 2020

======union all sql test result (filter by contributor_name)

1)old sql (current sql):
SELECT * 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.cmte_id = ofec_committee_history_mv_1.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = 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.clean_contbr_id = ofec_committee_history_mv_2.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = ofec_committee_history_mv_2.cycle
WHERE disclosure.fec_fitem_sched_a.is_individual = true
AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('ActBlue:*')
ORDER BY disclosure.fec_fitem_sched_a.contb_receipt_dt DESC, disclosure.fec_fitem_sched_a.sub_id DESC
order by
LIMIT 30

2)new sql:(union all)

SELECT * 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.cmte_id = ofec_committee_history_mv_1.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = 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.clean_contbr_id = ofec_committee_history_mv_2.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = ofec_committee_history_mv_2.cycle
WHERE disclosure.fec_fitem_sched_a.is_individual = true
AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('ActBlue:')
ORDER BY disclosure.fec_fitem_sched_a.contb_receipt_dt DESC, disclosure.fec_fitem_sched_a.sub_id DESC
where two_year_transaction_period =2020
order by
LIMIT 30
union all
SELECT * 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.cmte_id = ofec_committee_history_mv_1.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = 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.clean_contbr_id = ofec_committee_history_mv_2.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = ofec_committee_history_mv_2.cycle
WHERE disclosure.fec_fitem_sched_a.is_individual = true
AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('ActBlue:
')
ORDER BY disclosure.fec_fitem_sched_a.contb_receipt_dt DESC, disclosure.fec_fitem_sched_a.sub_id DESC
where two_year_transaction_period =2018
order by
LIMIT 30
union all
SELECT * 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.cmte_id = ofec_committee_history_mv_1.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = 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.clean_contbr_id = ofec_committee_history_mv_2.committee_id AND disclosure.fec_fitem_sched_a.two_year_transaction_period = ofec_committee_history_mv_2.cycle
WHERE disclosure.fec_fitem_sched_a.is_individual = true
AND disclosure.fec_fitem_sched_a.contributor_name_text @@ to_tsquery('ActBlue:*')
ORDER BY disclosure.fec_fitem_sched_a.contb_receipt_dt DESC, disclosure.fec_fitem_sched_a.sub_id DESC
where two_year_transaction_period =2016
order by
LIMIT 30

test result:

-----------day1------------

dev:
d1 new1: 8:50am 23 secs, --new sql
cache 0.6sec.
d1:9am: 1 () 2min 24 sec --old sql
d1:9am 2 (cache) 5 sec

stage:
d1 new1: 8:50am 29 secs, --new sql
cache 0.7sec.
new1:9am 29 secs, cache 0.5sec.

d1:9am: 1 () 2min 48 sec --old sql
d1:9am 2 (cache) 6 sec

-----------day2------------
dev:
d2 new1: 8:50am 27 secs, --new sql
cache 0.6sec.

d2:9am: 1 () 2min 24 sec --old sql
d2:9am 2 (cache) 5 sec

stage:
d2 new1: 8:50am 27 secs, --new sql
cache 0.7sec.

new1:9am 29 secs, cache 0.5sec.--new sql

d2: 9am: 1) 2min 55sec --old sql
d2: 9am 2) (cache) 7 sec

conclusion:

  1. after 24 hours, cache is clean

  2. union all sql is 6 times faster than existing sql.

@rfultz rfultz modified the milestones: Sprint 13.6, PI 13 innovation 1 Oct 9, 2020
@lbeaufort lbeaufort removed their assignment Oct 28, 2020
@lbeaufort lbeaufort modified the milestones: Sprint 13.8, Sprint 13.9 Nov 3, 2020
@rfultz rfultz modified the milestones: Sprint 13.9, Sprint 13.10 Dec 1, 2020
@patphongs patphongs modified the milestones: Sprint 13.10, Sprint 13.11 Dec 9, 2020
@patphongs patphongs removed this from the Sprint 13.11 milestone Dec 22, 2020
@lbeaufort lbeaufort added this to the PI 13 innovation 2 and PI 14 planning milestone Jan 14, 2021
@lbeaufort lbeaufort self-assigned this Jan 26, 2021
@lbeaufort lbeaufort modified the milestones: Sprint 14.1, Sprint 14.2 Mar 5, 2021
@lbeaufort
Copy link
Member

Locust testing had very variable results for the same setup, so relying more in UNION ALL EXPLAIN ANALYZE: https://docs.google.com/spreadsheets/d/15MVrc6oFqOiRPGlHDWo2-VduciM-vQHcUJU3hyaT_pQ/edit#gid=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment