In article <[EMAIL PROTECTED]>,
Jorge Godoy <[EMAIL PROTECTED]> writes:

> Harald Fuchs <[EMAIL PROTECTED]> writes:
>> Why putting gapless numbers into the database at all?  Just calculate them at
>> query time.

> And how would you retrieve the record that corresponds to invoice number
> #16355, for example?  Recalculating few records is fine, but millions of them
> everytime you need to recover some of those is something that doesn't look
> efficient to me... 

This would be

  SELECT whatever
  FROM tbl
  ORDER BY id
  LIMIT 1
  OFFSET 16355 -1

Since id is the primary key, this can use an index scan.


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to