[Rails] Re: Postgres match with regular expression
> able to insert a regular expression, that I will then use to match
> against the path. That way having a record value like /\/users\/(\d*)/
> to match a client request path like /users/1234.
>
> | path | response |
> ------------------------------
> | /\/users\/(\d*)/ | { users } |
>
> I first looked athttp://www.postgresql.org/docs/8.3/static/functions-matching.html
> (section 9.7.2), but that is the reverse problem
I'm not sure what problem you're trying to solve with an approach like
this, but a quick test confirms that a query such as:
select response
from paths
where '/users/1234' similar to path
would actually work. Of course, it will require setting up a custom
sql condition, but that's not really a huge deal. As for the previous
reply, a sequential table scan on 10k records isn't a big deal for
PostgreSQL on any modern machine, in fact I rarely even think about
indices until tables are at least approaching 10k records and usually
well beyond.
Jim Crate
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home