Skip to content

Conversation

@codeodor
Copy link
Collaborator

After some further research on issue 98 (#98), it looks like it's just doing the same thing Rails' version is doing, but adding some special cases for CPK.

However, I didn't find out how/why Rails was not using the subquery.

Instead, I just created a case like "if we're only selecting 1 column, there's no need for the subquery, so don't use it"

Not sure if you're interested in including that or not, but in case you are, I've submitted this pull request.

I don't like to hack around this kind of thing -- it makes the code uglier and harder to follow -- but if everyone else is seeing 5-10 seconds to count records using the subquery vs. almost instantaneous results without the subquery, then I guess it's useful.

If it's just me, well then I guess I'll have to monkey patch it in my project. =)

@codeodor
Copy link
Collaborator Author

I should also note that I only ran the tests for mysql, since I didn't have the other DBs handy.

cfis added a commit that referenced this pull request May 5, 2012
@cfis cfis merged commit 63854f2 into composite-primary-keys:master May 5, 2012
@cfis
Copy link
Contributor

cfis commented May 5, 2012

Ok, merged in, will see if it works with postgresql or not.

@codeodor
Copy link
Collaborator Author

codeodor commented May 7, 2012

Cool. I'm back from traveling as of today, so I plan to do a little more of the research we discussed on the comments of issue #98 when I'm caught up on email.

cfis added a commit that referenced this pull request May 20, 2012
Pull Request #99 had a bug when selecting distinct on a column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants