on 2015 Nov 18 3:29 PM
When our database was set up (before my time), I am guessing for future proofing reasons, it was decided to use text type fields for any textual type columns
This includes fields such as customertype which has a max of 3 chars for example.
I read somewhere that text columns allocate a 2k of space regardless of what is stored, but I have been unable to locate that source again.
Am I right in thinking that optimizing to the correct column sizes will improve read/write performance (I am not too fussed if it is only going to save a bit of disk space)
If I want to go ahead and convert these columns to more realistic lengths, is there a boundary I should use, between choosing a varchar and a text type
Eg, if varchar(2000) performs the same as text, then I will just leave it alone.
Request clarification before answering.
We're talking about a SA 12 database, correct? (*)
As for SQL Anywhere, TEXT is just a system-defined domain implemented as a LONG VARCHAR, so I think your question is fully addressed here:
From that I would think that your information about a minimum 2K storage is basically wrong.
To 1: Performance on the server-side may not increase when using shorter VARCHAR but client-side performance should increase because no SQLGetData()-like calls (or the according special fetch operations of other APIs) are required.
To 2: A normal VARCHAR (or NVARCHAR) allows up to 32767 character so I think that's a limit that could be used to distinguish between "normal" and "wide" strings.
(*) In contrast, say with MS SQL Server, a "text" datatype is a (since SQL Server 2005 deprecated but still available with SQL Server 2014) datatype with a lot of disadvangages compared to "normal" varchar datatypes, e.g. you cannot use a within a trigger, the accesses are different, no search facilities - I do know because we use a third-party system using those types a lot, and it's really annoying.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also check the INLINE and PREFIX clauses to understand how SQLA is storing the data in the table rows.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
30 | |
10 | |
8 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.