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

Drop index on original_url and prevent a possible AttributeError exception #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ux2Daoch
Copy link

If the original_url field is longer than its hash, then it is more effective to drop the index on original_url and use the index on original_url_hash. Less storage space is used and the queries are processed faster.

In my case the average length of the original URLs is 140 characters. I suppose that there are many cases when the original URLs are shorter then 64 characters and the index on original_url offers better performance than the index on original_url_hash. I think however that the index on original_url_hash offers a good middle ground.

By adding the original_url_hash field to the get_or_create call
the index on original_url_hash is used instead. Grace to this,
less storage space is used and the db operations are faster.
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.

None yet

1 participant