Flemming Frandsen wrote 
(
unfortunately he uses a characterset which results in this message:
This message uses a character set that is not supported by the Internet
Service.  To view the original message content,  open the attached message.
If the text doesn't display correctly, save the attachment to disk, and then
open it using a viewer that can display the original character set. 
)

>On Tue, 27 Nov 2001, [iso-8859-1] Alberto Barcelón wrote:
>
>>      CREATE TABLE test (
>>              id      INTEGER NOT NULL        DEFAULT seqtest.NEXTVAL,
>>              name    CHAR(20)
>>      )
>
>Just a warning: It is extremely bad to not declare the primary key as SAP
>DB then creates the default primary from all columns in the table:

???  unfortunately I have to say: that is not true. True is:
If no user-defined primary key is specified, SAP DB appends the column
SYSKEY CHAR (8) BYTE
to the table and this appended column is the primary key!!
BTW: keys can be up to 1024 bytes in length, rows up to around 8000 bytes,
therefore the above
         would not work

>1) You get tablescans to find stuff by id.

If id is neither keycolumn nor indexed column, a WHERE id = 4711 has no
other chance than to use
a tablescan. In case you use the SAP DB implicit primary key SYSKEY, then
the above WHERE-
clause had to use a tablescan. If you specify an index on id, that index
will be used in this case.

>2) You get slow updates to the name column because the index needs to be
>updated.

See above, there is no implicit index (part of index) on name if you do not
specify a primary key.
Therefore: don't worry about this.

Elke
SAP Labs Berlin

Reply via email to