Last active
September 26, 2015 16:58
-
-
Save norman/1129745 to your computer and use it in GitHub Desktop.
Friendly Id Benchmarks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git revision: 9b395bad80da30f0101e5df91cc9d18aeac2b3c1 | |
$ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.0.rb DB=postgres bundle exec rake bench | |
------------------------------------------------------------------------ | |
Using ruby 2.0.0 AR 4.0.0 with postgres | |
Rehearsal ---------------------------------------------------------------------------------- | |
find (without FriendlyId) 0.340000 0.030000 0.370000 ( 0.473857) | |
find (in-table slug) 0.990000 0.040000 1.030000 ( 1.285145) | |
find (in-table slug; included FinderMethods) 0.420000 0.020000 0.440000 ( 0.663232) | |
find (external slug) 1.630000 0.050000 1.680000 ( 2.194663) | |
insert (without FriendlyId) 1.000000 0.080000 1.080000 ( 1.356241) | |
insert (in-table-slug) 3.130000 0.130000 3.260000 ( 3.921744) | |
insert (in-table-slug; included FinderMethods) 1.000000 0.080000 1.080000 ( 1.365883) | |
insert (external slug) 8.290000 0.310000 8.600000 ( 10.800216) | |
------------------------------------------------------------------------ total: 17.540000sec | |
user system total real | |
find (without FriendlyId) 0.290000 0.030000 0.320000 ( 0.423382) | |
find (in-table slug) 0.900000 0.030000 0.930000 ( 1.222101) | |
find (in-table slug; included FinderMethods) 0.430000 0.030000 0.460000 ( 0.703448) | |
find (external slug) 1.580000 0.040000 1.620000 ( 2.144805) | |
insert (without FriendlyId) 0.660000 0.070000 0.730000 ( 1.049766) | |
insert (in-table-slug) 3.060000 0.130000 3.190000 ( 3.845923) | |
insert (in-table-slug; included FinderMethods) 0.700000 0.070000 0.770000 ( 1.048894) | |
insert (external slug) 8.350000 0.330000 8.680000 ( 11.089634) |
Is there an index on the primary key?
In all SQL databases I'm familiar with, primary key constraints are implemented as a unique index. So, unless I'm mistaken in thinking that SQLite3 does this, then yes.
I think @hubsmoke wanted to ask if there is an index on the slug column. Is there?
@norman Did you notice that the benchmark specify postgres explicitly. I am confused why we are talking about SQLite here?!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What tests yielded these benchmarks?