Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: using constants

Re: using constants

From: Marten Lehmann <lehmannmapson_at_cnm.de>
Date: Thu, 29 Nov 2007 23:19:08 +0100
Message-ID: <5r8sakF1368i6U1@mid.individual.net>


Hello,

> To your first question, as others have said, it is not likely to make
> a difference. If the word defines a well known state, and the name
> will never change, it is just fine. A lookup table may be nice, but
> that depends on the way it is used.

would you say the same is true for joins? What would be faster,

this one?

domains



name (pk)
...

records



id (pk)
name (fk)
...

for a query like

select * from domains d, records r where d.name = r.name and d.name = 'whatever'

or this one:

domains



id (pk)
name (unique)
...

records



id (pk)
domain_id (fk)
...

for a query like

select * from domains d, records r where d.id = r.domain_id and d.name = 'whatever'

Mathematically it should be faster to compare two 4 byte non-zero integer values than two at least 8 byte strings. But the first solution is more elegant and intuitive.

Regards
Marten Received on Thu Nov 29 2007 - 16:19:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US