[EMAIL PROTECTED] wrote:

> On Tue, Jun 26, 2001 at 05:32:43PM -0400, Michael Bilow wrote:
> 
>> On 2001-06-26 at 21:45 +0200, [EMAIL PROTECTED] wrote:
>> 
>> 
>>> Why would this matter? Do databases assume that records with primary
>>> keys "near" one another will often be used together?
>> 
>> Yes, this is why they are called "primary keys."  Traditionally, database
>> engines would try to entry-sequence records by primary key, and there
>> remains an expectation that access by primary key will always be the
>> fastest and most efficient mechanism for accessing a table.
> 
> 
> It seems strange to me that locality would be important in this
> case. The assumption that record number 5 and record number 6 are
> inherently linked more than record 5 and record 8793 are would
> certainly hold for some databases, but that it should be true in the
> general case (or even just often enough that it matters)?

(From my understanding of relational databases) Actually it's not so 
much that the database assumes that they're linked as that the table is 
generally organized in some sort of B-Tree structure where the record's 
location in the tree (what page it's on) is determined by the primary 
key. This way when the database does a search by primary key, once it's 
found the key it doesn't need another IO to get the actual data. This 
just optimizes the case of finding by the primary key.


> 
> I can only see the usefulness for binary search, but there you would
> presumably build index tables anyway so actual location of data
> doesn't matter.

actual location matters only in terms of io. 

-danch




_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to