[Rails] Re: Re: Rails without a primary key

Michael Artz mlartz at gmail.com
Thu Jul 27 22:19:11 GMT 2006


> Although the size of the table presents an interesting challenge, this
> is exactly the case for an otherwise meaningless surrogate key. Indexing
> on, and selecting by, that one :id column is much more performant than a
> 6-10 column natural key.

I think the idea is that no access to the table will result in a
single row being returned so there is no reason, practical or logical,
to have a key on this table.  In my case, most queries use some form
of IP and port and generate a series of records.

And (in my case, not sure about OP) we use Postgres' table
partitioning, which works great.  The issue isn't necessarily table
size for query performance, but just table size in general.  I have
similar (legacy) projects generating 200-300GB per day of traffic, so
every bit that we can save per record results in a fairly large
savings overall.

Rails has been a quick way to put a face on those databases and it
works great for simple models or those that conform to Rails
conventions.  That composite key plugin looks mighty useful, however.


More information about the Rails mailing list