Manolis Christodoulou wrote:

I would use a char(4) field (fixed length) as a primary key. It would serve both as an ID and at the same time would have been informational, and I think fix length strings are faster than varchars.


Just wondering on this - CHAR(4) vs VARCHAR(4) is one *faster* then the other. Conventional thinking says yes, for in RDBMS systems such as Oracle, Sybase, MS SQL that was indeed the case - but does that hold true for HSQLdb? I don't know that answer to that although my inclination is that it is not the case, in fact it may be just the opposite even.

Here is a quote from the HSQLdb documentation:

Prior to 1.7.2, all table column type definitions with a column size, precision or scale qualifier were accepted and ignored.

In 1.8.0, such qualifiers must conform to the SQL standards. For example INTEGER(8) is no longer acceptable. The qualifiers are still ignored unless you set a database property. SET PROPERTY "sql.enforce_strict_size" TRUE will enforce sizes for CHARACTER or VARCHAR columns and pad any strings when inserting or updating a CHARACTER column. The precision and scale qualifiers are also enforced for DECIMAL and NUMERIC types. TIMESTAMP can be used with a precision of 0 or 6 only.


So I wonder is there any difference is storage mechanism for a CHAR vs VARCHAR as there is in some other DBMSs?

Anyway - one of those things worth investigating when time permits I suppose.

Drew



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to