News for hackers. Stuff that matters.
Re:Ask HN: Why can't we just use this idea for clean URLs wi... by grzm on Friday November 04, 2016 @11:41PM (#12878027)
If you have an index on the column, it shouldn't be an huge issue. You'd have similar issues if you had no index on the integer column.

Of course, if you're really concerned about it, you can easily put together a test. I suspect other latencies in your app would be larger than those due to the difference between integer lookup and text lookup. But like I said: if you're highly sensitive to performance, you'll want to be measuring against your application, your stack, regardless of advice you might read about on the internet.

If beautiful URIs are a priority, you can use a separate mapping table or service (memcache? Redis?) that maps the URI to a database ID. Of course, this adds latency/overhead as well. This could also give you flexibility in supporting multiple slugs for a single story.

There are no comments on this comment yet.