
This week I'll be presenting at Croatian Oracle User Group Conference (HROUG) which will take place in Rovinj in Croatia, a beautiful old city in Istria at the Adriatic coast.
HROUG is a very strong and active user group. Every year they organize excellent conference, so this year it is already the 15th. Last year I was presenting about execution plan stability and my presentation was selected as the best presentation in the "Database and Technology" track.
Despite the doubts about the topic "Query Transformations" (described in my previous post) presented at OOW which was quite technical I found extremely nice comments in different blog posts written by the attendees of my presentation. Thanks for sharing that with others. I was really happy and at same time surprised to have the room almost full and I hope everybody has learned at least something useful.
This is my second trip to Sydney. The first time I came I managed to do a lot of the tourist stuff, but I never managed a trip up the Sydney Tower or Taronga Zoo. I did both of those yesterday. Here are some photos.
The tower gives an excellent view of the city. It’s worth doing that as your first activity, so you can get a feel for that you are getting yourself in for. As part of the trip you also get to ride on OzTreck, a virtual tour of Australia. This was actually a lot of fun. It’s certainly worth 10 minutes of your time.
Next stop was the zoo. I bought a zoo pass that includes the ferry, skyride and zoo entrance. If you have a concession ticket there are cheaper ways to get in. On the one had I dislike zoos because they have animals in captivity. On the other hand, I love them. Taronga Zoo has a nice feel about it, but some of the exhibits seem a little small compared to other zoos I’ve been to. The advantage is that you get a good view of the animals. The downside is I’m not sure it is a great environment for some of the animals.
The information desk suggested I should try and see the bird show, which didn’t strike me as sounding too interesting, but it was in the direction I was walking and started just as I got to the show ground. Well, I couldn’t have been more wrong. If you are going to the zoo you should definitely see the show. I don’t know about you, but I’ve never had a bird of prey with a 2 metre wing span fly a couple of inches above my head before. Very impressive. It was a really good show for adults and kids alike.
After the zoo it was a train ride back to the hotel in North Ryde and an early night before todays session. Unfortunately I only managed about 4 hour sleep, which included 5 hour gap in the middle of it.
So today is day 1 of my PL/SQL course in Sydney, followed immediately by a trip into town to speak at the Sydney meetup organised by the guys from Pythian.
Cheers
Tim…
Pity us poor US DBAs — safely secure using our ancient, many-times-upgraded Oracle 6 databases with their US7ASCII character sets.
We knew that ASCII only covered 0-127, but who could blame us when we started putting WE8MSWIN1252 "international" characters into those fields — the database let us, and it felt kind of sexy putting in cool European characters with umlauts and accents on them.
Besides, all of our business was with other American companies, and if someone had some "funny" characters in their name, then they just had to change them!
Of course, all of this is said with tongue firmly planted in cheek. Nowadays you’d better be able to handle Unicode in your database if you want to have a prayer of not being labeled as something older than teleprinters and typewriters.
I first encountered this situation when working with a US7ASCII database where we started using XMLTYPE columns — little did I know that XMLTYPE columns actually validated the character set of the XML document coming in — one of our fields was the country name.
Everything was fine until February 13th, 2004 — the day ISO added an entry for the Aland Islands… (which has an A with a diacritical ring above it).
We started seeing errors inserting our XML documents — all due to strict validation of the character set. Did we change character sets? No — we stopped using the XMLTYPE columns
Fast forward a few years and now I’m lucky enough to work with proper databases created with the AL32UTF8 character set — so now I can store my friend Mogens Noorgard name correctly (or I would if I could spell it…)
However, little did I realize that I needed to declare my columns differently…
You see, back in the day, VARCHAR2(10) meant that I wanted to store up to 10 characters in the column gosh darn it — I didn’t worry about bytes vs. characters — same thing right?
Er, no.
So in a brand new database with an AL32UTF8 character set, why was I getting column length errors trying to insert the string H,U,”Y with an umlaut” into a VARCHAR2(3) field?
Heck, isn’t “Y with an umlaut” just another character? It’s just WESMSWIN1252 character 255, right?
Don’t tell me it’s a character set issue — I’ve been trying to avoid opening up that NLS manual for years…
Ok, ok — open the manual and start reading about Unicode — specifically UTF-8. Uh-oh, I read the words "variable-length encoding" and the light starts to dawn…
Turns out that “Y with an umlaut” is 1 byte in WESMSWIN1252 (specifically 0xFF), but it’s 2 bytes in UTF-8 (0xC3BF).
But didn’t I declare the column to be 3 characters in length? So why does it care about the underlying encoding?
Enter NLSLENGTHSEMANTICS and the fact that the default is set to BYTE.
From the documentation:
http://download.oracle.com/docs/cd/E1188201/server.112/e10729/ch3globenv.htm#NLSPG235
Property
Description
Parameter type
String
Parameter scope
Environment variable, initialization parameter, and ALTER SESSION
Default value BYTE
Range of values BYTE or CHAR
By default, the character data types CHAR and VARCHAR2 are specified in bytes, not characters. Hence, the specification CHAR(20) in a table definition allows 20 bytes for storing character data.
This works well if the database character set uses a single-byte character encoding scheme because the number of characters is the same as the number of bytes. If the database character set uses a multibyte character encoding scheme, then the number of bytes no longer equals the number of characters because a character can consist of one or more bytes. Thus, column widths must be chosen with care to allow for the maximum possible number of bytes for a given number of characters. You can overcome this problem by switching to character semantics when defining the column size.
NLSLENGTHSEMANTICS enables you to create CHAR, VARCHAR2, and LONG columns using either byte or character length semantics. NCHAR, NVARCHAR2, CLOB, and NCLOB columns are always character-based. Existing columns are not affected.
You may be required to use byte semantics in order to maintain compatibility with existing applications.
NLSLENGTHSEMANTICS does not apply to tables in SYS and SYSTEM. The data dictionary always uses byte semantics.
Note that if the NLSLENGTHSEMANTICS environment variable is not set on the client, then the client session defaults to the value for NLSLENGTHSEMANTICS on the database server. This enables all client sessions on the network to have the same NLSLENGTH_SEMANTICS behavior. Setting the environment variable on an individual client enables the server initialization parameter to be overridden for that client.
Sigh…
Can anyone tell me why the default would be BYTE? Why would I want to declare character fields with BYTE lengths? Thank goodness it’s not in bits…
Anyway, we adjusted our standard to make sure that DDL always specifies BYTE or CHAR in the declaration now:
VARCHAR2(10 CHAR) instead of VARCHAR2(10), so now we can be sure…
Tanel Poder has put together an Online Virtual Oracle Conference and he asked me to participate. I had to think about it for about 2 seconds before I said yes. The speakers are Tanel, Cary Millsap, Jonathan Lewis and myself. Wow! How did I sneak into that line up you might wonder. Apparently Tanel asked Tom Kyte first, but Tom had to decline. It’s not the first time I’ve played second fiddle to Tom – and hopefully won’t be the last. I feel like I’m in pretty tall cotton (as we say in Texas).
Here’s how Tanel pitched the idea to me:
My reasoning is that we start from higher level and then drill down:
1) Cary talking about how to approach things right (and eventually find the problem SQL or operations)
2) I’m drilling down inside a SQL with row-source profiling (and eventually find where is the problem)
3) Jonathan talks why it happens and what to do about it (how to help CBO by writing better SQL)
4) Kerry talks how to help CBO and fix SQL when you can’t actually change the SQL text to any better
The whole idea of running a seminar on-line without anyone traveling is a very interesting topic. The technology has progressed to the point where it is quite possible. The idea of a short conference with multiple pretty well known speakers is also pretty cool. It will be interesting to see what kind of participation we get.
The conference is scheduled to be 8 hours spread over two days, Nov. 18 and 19. Follow the link below to read more about the event including the schedule, cost, how to sign up and abstracts for the talks.
Hope to see you there!
P.S. – There is a pretty good discount if you sign up before Nov. 1.
The title pretty much says it. In Oracle 11.2, if you have the Diag+Tuning Pack licenses and the SQL monitoring kicks in for your SQL statement, then instead of the old fashioned ERRORSTACK dump reading you can just query the V$SQL_MONITOR.BIND_XML to find the values and metadata of your SQL statement’s bind variables.
I’ve written an example here:
And a related comment – V$SQL_BIND_CAPTURE is not a reliable way for identifying the current bind variable values in use. Oracle’s bind capture mechanism does not capture every single bind variable into SGA (it would slow down apps which run lots of short statements with bind variables). The bind capture only selectively samples bind values, during the first execution of a new cursor and then every 15 minutes from there (controlled by _cursor_bind_capture_interval parameter), assuming that new executions of that same cursor are still being started (the capture happens only when execution starts, not later during the execution).
Here are few blogs which I’ve found lately and think that you should also check out if you’re interested in Oracle stuff (and take time to read blogs :)
Oracle performance & Grid Control
http://juliandontcheff.wordpress.com/
Oracle Exadata
http://ferhatsengonul.wordpress.com/
Oracle, Unix, storage (for DW)
http://dsstos.blogspot.com/
Oracle, Storage & Virtualization (VMWare)
http://oraclestorageguy.typepad.com/
Julian Dyke’s new blog (RAC, Data Guard so far – probably internals later :-)
http://juliandyke.wordpress.com/
If you are flying cattle-class it’s pretty easy to get annoyed, but here are a few things that really get on my nerves…
Hand Luggage
Aisle Etiquette
Headphones
Hygiene
Flight Attendants
Seats
Volume
Exiting the Plane
These and many more annoying habits can be found in the economy class seating of your favorite airline.
Cheers
Tim…
Call me paranoid, but when I started filling in a customs declaration that mentions the death penalty for drug traffickers, I suddenly got worried about the cold cures and vitamin C pills in my bag.
When I walked out of the airport in Singapore I couldn’t believe how humid it was. Dubai is hot, and Washington was very humid this year, but Singapore was something else.
I got to the hotel pretty late and I was teaching the next day, so I went straight to bed. The Oracle University office was about 1 km from the hotel so I walked to it. By the time I got there I felt like I needed a shower. Even at 08:00 in the morning it felt like hard work. After a couple of hundred yards I could feel myself panting like a dog.
The class was pretty small, with nine paying attendees and one Oracle University instructor who came along for the ride. Big classes can be exciting, but small classes feel more informal, so either way it’s pretty cool. We went out as a group at lunch time on both days, so there was plenty of time for gossiping, as well as the teaching stuff.
Singapore is full of restaurants. It feels like every building has a food court in it, and most of the places are busy. Speaking to a couple of people on the course, it seems many of the people never cook. Eating out is so cheap that unless you are cooking for about 6 people, it’s cheaper to eat out that cook at home. Sounds good to me.
On the first evening I went for a walk around the bay area. It was dark by the time I got out, so all the photos are night shots. I’m not great with a camera at the best of times, but add in darkness and you know it’s going to go wrong. I took a lot of shots, but I’ve deleted most of them because they were just too blurry. The best of them made it here. The “altitude” shots, where you can see my reflection in the glass, were taken from the Singapore Flyer. My photos don’t do it justice.
The skyline would make you believe the place is like a scene out of Blade Runner, but when you are walking around the central business district it actually feels quite open. There is a lot of space between the buildings, so it never feels claustrophobic. Another nice thing is the streets are very clean. No litter, no chewing gum stuck everywhere and no dog crap on the pavements. If only the residents of Birmingham could act like this.
The bay area is obviously where all the money is. There is a crazy casino built to look like a boat is sitting on three towers. Next to that there is an absolutely giant shopping mall, half of which is still under construction. They were prepping for a Christian Dior show when I was walking round. The other side of the bay seems to be where the young and rich go out to pose in the evening. Lots of very expensive cars and people trying hard to be noticed. I’m surprised I wasn’t escorted away by the authorities.
On the second day of the course we had a couple of delays, so I ended up running over by an hour. No big surprise there.
I was going to go to the Night Safari on the second evening, but I foolishly turned on my laptop when I got back to the hotel and the next thing I knew it was 22:00, so I went to bed.
This morning it was a 06:00 start to get to the airport. I waited for a few minutes for a taxi and started to break a sweat standing still. Even at silly o’clock in the morning it was boiling.
The journey from Singapore to Sydney was pretty standard seven hour flight, so nothing major to report, but a few little incidents will be added to a general travel rant (about passengers) I am in the process of writing.
Cheers
Tim…
We will take a look at in this blog post, by testing several different approaches and comparing the time and the statistics for each scenario.
The tests have been performed on a quarter rack ExaData database machine (2 db nodes – with 16 cores each and 3 storage servers). The database is setup for a data warehouse implementation and has been patched with bundle patch 5 at the time of testing.
The tests were executed on a table with 403M rows distributed over 14 range partitions – 7 non-compressed and 7 partitions compressed with HCC query option. Each test spans over two partitions covering 57.5M rows. Please note the dimension tables contain 4000 or less rows. The data is production data and are event based data, meaning data is generated when a certain events occur.
Each test-case/SQL has been executed 5 times under different scenario:
The test cases used are from a warehouse environment and I have modified the column and table names. For the bitmap test-cases I had to hint the queries to ensure the bitmap indexes was actually used.
The output from the test cases is over 20K lines, so I have summed up the elapsed time and a few statistics in tables below to provide a better overview.
Table figure for basic breakdown – Test case 1
|
Stats / Tests |
1 |
2 |
3 |
4 |
5 |
|
Elapsed time sec |
8.87 |
12.00 |
09.22 |
185.05 |
149.55 |
|
cell physical IO bytes saved by storage index |
0 |
0 |
0 |
0 |
0 |
|
cell physical IO bytes eligible for predicate offload |
5,209,325,568 |
0 |
5,209,325,568 |
0 |
0 |
|
cell physical IO interconnect bytes returned by smart scan |
2,562,203,600 |
0 |
2,562,201,584 |
0 |
0 |
|
cell flash cache read hits |
9 |
26 |
9 |
9,290 |
2,063 |
|
CC Total Rows for Decompression |
|
57,586,000 |
|
|
57,586,000 |
This is a basic query, which is used for high level summaries and serves as a good base line to compare with, for the other test-cases. There is no use of a where clause in the test case, so we will not benefit from any storage indexes in this case. The first 3 tests are without any indexes on the fact table and are performing much better than test 4 and 5 and we should of course not expect the CBO to follow this path anyway. It is evident for test 1 and 3 that the performance gained is supported by the storage server offloading and the smart scans. The above CC stats for test 2, tell us that the db node performs the decompression, so this test will have to burn extra CPU cycles compared to test 1 and 3. There is more to be mentioned for test 2, but I’ll try to cover that in the conclusion.
Table figure for LC breakdown - Test case 2
|
Stats / Tests |
1 |
2 |
3 |
4 |
5 |
|
Elapsed time sec |
2.05 |
19.17 |
1.84 |
30.33 |
36.58 |
|
cell physical IO bytes saved by storage index |
4,186,636,288 |
0 |
4,186,636,288 |
0 |
0 |
|
cell physical IO bytes eligible for predicate offload |
5,209,292,800 |
0 |
5,209,292,800 |
0 |
0 |
|
cell physical IO interconnect bytes returned by smart scan |
317,496,848 |
0 |
317,497,280 |
0 |
0 |
|
cell flash cache read hits |
18 |
59 |
36 |
1,043 |
219 |
|
CC Total Rows for Decompression |
0 |
57,782,554 |
0 |
0 |
7,842,364 |
Similar finding as we saw from the 1st test case; however, in this test-case we are performing the breakdown for a certain ID and therefore the performance of test 1 and 3, improved further from the IO saved by the Storage Index. For this test case, I ran test 1 and 3 on the save partitions and it is worth noticing, that second time around the savings from the Storage Index improved; so the storage indexes are further maintained/improved as we select data from the tables and partitions.
Table figure for lp breakdown - Test case 3
|
Stats / Tests |
1 |
2 |
3 |
4 |
5 |
|
Elapsed time sec |
2.99 |
6.01 |
2.72 |
49.22 |
39.29 |
|
cell physical IO bytes saved by storage index |
2,623,143,936 |
0 |
2,623,799,296 |
0 |
0 |
|
cell physical IO bytes eligible for predicate offload |
5,209,325,568 |
0 |
5,209,325,568 |
0 |
0 |
|
cell physical IO interconnect bytes returned by smart scan |
674,439,456 |
0
|
674,436,288 |
0 |
0 |
|
cell flash cache read hits |
64 |
44 |
10 |
2,113 |
635 |
|
CC Total Rows for Decompression |
0 |
57,979,108 |
0 |
0 |
15,582,048 |
Similar findings as we saw from the 2nd test case; this test is just performed on a different ID, which has a higher distinct count than the first ID we tested in test case 2; and as a result of that and on how the data is sorted during insert we are seeing less IO saved by the storage index.
Table figure for spcl breakdown – Test case 4
|
Stats / Tests |
1 |
2 |
3 |
4 |
5 |
|
Elapsed time sec |
1.67 |
13.69 |
01.14 |
12.77 |
7.90 |
|
cell physical IO bytes saved by storage index |
4,531,191,808 |
0 |
4,532,174,848 |
0 |
0 |
|
cell physical IO bytes eligible for predicate offload |
5,209,325,568 |
0 |
5,209,325,568 |
0 |
0 |
|
cell physical IO interconnect bytes returned by smart scan |
237,932,736 |
0 |
237,933,312 |
0 |
0 |
|
cell flash cache read hits |
73 |
52 |
10 |
594 |
183 |
|
CC Total Rows for Decompression |
0 |
57,782,554 |
0 |
0 |
5,614,752 |
This test case is performed with a where clause on multiple ID’s. Again test 1 and 3 are taking advantage of the Exadata features and are performing well. Test 4 and 5 are still not close to test 1 or 3, but have definitely become a bit more competitive. Comparing the two HCC tests (2 and 5) test 5 seems to do better as it only has to burn CPU cycles for 10% of the results set of test 2. A valid question to ask here would be why we are not seeing any benefits from either Storage offloading or indexing on test 2, but again I’ll defer that discussion to the conclusion.
Table figure for ttl breakdown - Test case 5
|
Stats / Tests |
1 |
2 |
3 |
4 |
5 |
|
Elapsed time sec |
12.82 |
15.50 |
11.67 |
254.26 |
304.92 |
|
cell physical IO bytes saved by storage index |
0 |
0 |
0 |
0 |
0 |
|
cell physical IO bytes eligible for predicate offload |
5,209,325,568 |
0 |
5,209,325,568 |
0 |
0 |
|
cell physical IO interconnect bytes returned by smart scan |
2,328,566,432 |
0 |
2,328,567,440 |
0 |
0 |
|
cell flash cache read hits |
9 |
15 |
9 |
132,467 |
2,341 |
|
CC Total Rows for Decompression |
0 |
57,586,000 |
0 |
0 |
61,643,318 |
Very similar findings as we saw from the 1st test case; the only difference is this query looks examine the time to something.
Table figure for ttlsc breakdown - Test case 6
|
Stats / Tests |
1 |
2 |
3 |
4 |
5 |
|
Elapsed time sec |
1.16 |
4.57 |
1.01 |
12.71 |
03.87 |
|
cell physical IO bytes saved by storage index |
4,697,096,192 |
0 |
4,698,832,896 |
0 |
0 |
|
cell physical IO bytes eligible for predicate offload |
5,209,292,800 |
0 |
5,209,292,800 |
0 |
0 |
|
cell physical IO interconnect bytes returned by smart scan |
55,906,960 |
0 |
55,906,384 |
0 |
0 |
|
cell flash cache read hits |
9 |
31 |
10 |
3891 |
107 |
|
CC Total Rows for Decompression |
0 |
57,749,795 |
0 |
0 |
1,998,299 |
Very similar findings as we saw for the 4th test case.
Most warehouse like queries I have performed in our Exadata environment is doing well without indexes on fact tables. So it is no surprise to me to hear more and more people are dropping most of their indexes and take advantage of the Exadata features. If you like to keep the primary key indexes on your dimension tables to ensure the hassle of resolving the duplicate key issues, that seems to be a valid option as well.
In my environment I’m still to find a case where the bitmap index search could compete with the no index approach; and let just say we found such a case, when it would still have to show significant improvements before I would choose that path; Consider the benefits of not having to maintain the bitmap indexes after each load. There are also several restrictions with bitmap indexes that would be nice not to have to worry about.
Now, I mentioned that I would get back to the test 2 results, which were based on Storage FTS on partitions compressed with the HCC query option. In the past I have performed queries on HCC tables and have seen IO savings from the Storage indexes.
Initially i suspected the test2 results observed above to be a bug or alternatively be related to my HCC compressed partitions are only 29MB a piece versa 2.4GB uncompressed. Oracle support/development has confirmed it to be related to the data size, as we can see from the stat "cell physical IO bytes eligible for predicate offload", which doesn't get bumped up after query. The reason for that is after partition pruning, the table is too small for predicate push to kick in and since predicate push doesn't kick in, the Storage Indexes won't kick in either.
Please be aware i don't know the Storage index internals, but I look forward to learn.
Recent comments
17 weeks 4 days ago
27 weeks 2 days ago
29 weeks 12 hours ago
32 weeks 2 days ago
34 weeks 3 days ago
44 weeks 14 hours ago
45 weeks 4 days ago
46 weeks 4 days ago
46 weeks 5 days ago
49 weeks 3 days ago