on 2018 Jul 16 8:28 AM
I am trying to keep this short but I have to explain some details of my/our issues. Below there is a TLDR and the Questions!
I am currently analysing a performance issue on a client system with Sybase SQL Anywhere 12/16.
In short this client upgraded from sa-12 to sa-16. Reads and writes have slowed down significantly. Best case 25% slower, worst (some complex view) 1000% or no result is found within a reasonable timeframe.
I have been given access to a testing environment: One dbeng12, (old backup) one dbeng16 (newer backup).
The only key difference I have been able to find is the number of extension pages. Some table(s) have a long varchar column. This is a “Note” Field which most of the times is NULL but can contain longer texts.
I looked at the fragmentation tab in Sybase central (and the corresponding statement):
Table A in sa-12 (Pagesize 16k):
Rows: 49.800.000
Number of Pages 700.000
Number of extension Pages: 125 (not thousand)
Table A in sa-16 (Pagesize 16k):
Rows: 53.400.000
Number of Pages 751.000
Number of extension Pages: 246.000
Difference in rows and (normal) pages is due to the 6 months that passed between the two backups.
I am being assured that the long-varchar column in question has not been updated or alterd in any significant way. Which means all of the data which was present 6 months ago, is still part of the data today and therefore within the table today.
I have been reading up on blobs and extension pages. As far as I now understand the long varchar column is considered a blob. This means that as soon as this column is about to contain more than 254 bytes of data, this data will (by default) be placed on an extension page. (In short: If an Update extends above PCTFREE, the page is full or an INSERT trys to insert more than 254 bytes -> row split and the data of that rows column will be placed on an extension page.
I don’t understand how it is possible that I have almost no extension pages for this table in sa-12 and a quarter of a million in sa-16.
I have tried to reorganize the table in sa-16 and after a checkpoint and refresh the numbers almost stayed the same. The extension pages even went up by about 10.000.
Even if there was a big change within the long varchar colums (i.e. the client has added a lot more data) I have to assume that the data within the long varchar columns is here to stay.
TLDR: How can I increase read performance for tables which have a long varchar column? For most rows this column is NULL. For rows that contain data, the average length of this column is about 10.000 characters. I can’t change the table’s structure due to external circumstances.
My current Ideas:
INLINE
I have experimented with the INLINE Column attribute but if I set this to about 11.000 bytes this would mean, with 16k pagesize, one row per page in a worst case scenario.
BLOB INDEX
I have only read about this but an Index on the long varchar columns “could” increase performance. My worry here is that I would add another huge block of data containing the same information the extended pages contain, only to find data within the extended pages. I don’t know if this would do anything but my gut feeling says that this will not help.
Realigning the Columns
I have almost scrubbed this idea. I have read that a row split not only moves the “problem column” data to an extension page, but also every column that comes after that column within that row. This would mean that I could create a new long varchar column, which would now be located at the end, copy the data from the old column, drop the old one and rename the new column. This would move my “problem column” to the end of the row and in theory mean that even if a row split happens, all columns remain on the page except for the long varchar columns which would be located on the extension pages.
This idea might be based on false information as I have read that in case of a row split only the “culprit” column gets ostracized. But I might be mixing row splits and row continuations which is why I wanted to present this solution.
I would be very thankful for any input or ideas!
Best regards
Daniel
### UPDATE I’ll add information here that I forgot and was asked:
User | Count |
---|---|
66 | |
11 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.