Skip to content

Commit

Permalink
Nah, these queries aren't slow
Browse files Browse the repository at this point in the history
I just benchmarked them. I rewrote them as joins, and that wasn't faster, to my surprise.
  • Loading branch information
waldoj committed Jan 10, 2024
1 parent ec62671 commit deae3e9
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions cron/partisanship.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@

# Calculate the percentages of the legislators' party memberships who have cosponsored any bill
# introduced by this legislator.
// Using this "IN" clause is just ridiculous. The query takes a good .2 seconds, which is way
// too long. There's got to be a faster way to do this.
$sql = 'SELECT representatives.party, COUNT(*) AS number
FROM bills_copatrons
LEFT JOIN representatives
Expand Down Expand Up @@ -113,8 +111,6 @@
# of bills copatroned by this legislator. Meaning, look at every bill that this legislator has
# copatroned, and look at every other copatron of those bills, and calculate the percentage of
# those copatrons that are Democrats, Republicans, and independents.
// Using this "IN" clause is just ridiculous. The query takes a good .1 seconds, which is way
// too long. There's got to be a faster way to do this.
$sql = 'SELECT representatives.party, COUNT(*) AS number
FROM bills_copatrons
LEFT JOIN representatives
Expand Down

0 comments on commit deae3e9

Please sign in to comment.