Today i was reading http://tonguc.wordpress.com/2008/06/26/oracle-vs-sql-server-a-never-ending-story/ Tonguç’s blog, I really liked MS’s filtered index idea. It could be possible to use it in oracle with a workaround.
Not an oracle related post. Life is stange, full of unexpectable scenerios. I think it wont be easy to make posts about oracle from now on. The below code is an algorithim comparision for finding th Nth element of a given list.
10.2.0.4 came with some 11g features, an extended dbms_stats package. I had made some basic demonstraions below.
February 22, 2008 – 2:15 pm
Parallelism and partitioning are two excellent features of Oracle. What is the relation between CBO and these two guys? Well I catch some issues. First of all lets create a table with range partitioning:
SQL> select version from v$instance;
VERSION
—————–
10.2.0.1.0
CREATE TABLE part_table
PARTITION BY RANGE (c1)(
PARTITION p1 VALUES LESS THAN (100000),
PARTITION p2 VALUES LESS THAN (200000),
PARTITION p3 VALUES [...]
February 10, 2008 – 8:15 pm
I had my 2 presentation this weekend. It was a fantastic book of Lewis, CBO optimizer. I had met possible future interns of Turkcell. After nearly 10 session they got really confused . During my first session, “Selectivity issues”, I showed my own examples. Since the topic is issues, we really dealt with lots [...]
January 31, 2008 – 7:06 pm
One of my colleague asked me about how he can write better SQL. Despite he is a java developer, I appreciate his will to understand database. When I said, “I really can not teach you this in ten minutes”, he lost his will. Any way, Lets talk about 10053 trace file. Oracle dumbs its execution [...]
April 22, 2007 – 10:15 pm
Eşzamanlılık söz konusu olunca, kaynaklara erişim yöntemleri bazı kısıtlar ile denetlenmelidir. Neden denetlenmelidir? Şöyle izâh edelim: Varsayalım ki elimizde bir simgesel mikroişlemci dili var. Komutları:
YÜK : bir bellek adresinden mikroişlemcinin bir saklayıcısına (register) değer atar.
YAZ : mikroişlemcinin bir saklayıcısından bir bellek adresine değer atar.
ART : Saklayıcının değerini 1 arttırır.
Elimizdeki yazılım şu şekilde:
kod1:
YÜK $4000, [...]
Concurrency comes with overhead of locking problem. Oracle uses pessimistic locking on default. SELECT * FOR UPDATE locks related rows for possible writes, because SELECT * FOR UPDATE means “I will write to these rows, do not touch them”. OK, here comes question, why a writer do really block other writes? Because a writer altering [...]
January 16, 2007 – 6:40 pm
It is very hard for me to publish code in my blog. unidentification, lock of colors etc..
http://rapidshare.com/files/12000281/codeFormatter.zip.html
This is a simple program that formates your files to publish on wordpress.
usage is:
ert@SEMERKAND:~/jdevhome/mywork/codeFormatter/Client/classes/client$ java -classpath .. client.Main in.tex out.tex 4
java.lang.Exception: no valid #CODE# found
at client.BlockHandler.process(BlockHandler.java:79)
[...]
January 15, 2007 – 11:10 pm
I have been working on my friends post
here is my test case:
————————————————————————————————————————–
ert@SEMERKAND:~$ cat dnm.cpp
#include <iostream>
union manken_u {
char ch;
int integer;
double db;
};
#pragma pack(2)
struct manken_s_p {
char ch;
int integer;
double db;
};
#pragma pack()
struct manken_s {
char ch;
int integer;
double db;
};
#define sub(x,y) (int)(x)-(int)(y)
int main()
{
std::cout
<< ”size of union: ” << sizeof(union manken_u) << std::endl
<< ”size of struct: ” << sizeof(struct manken_s) << std::endl
<< ”size of packed struct: ” << sizeof(struct manken_s_p) << std::endl
<< ”size of char+int+double: ” << sizeof(char)+sizeof(int)+sizeof(double) << std::endl;
manken_s my_struct;
char* base = &my_struct.ch;
std::cout
<< ”offset of char ” << sub(base,&my_struct.ch) << std::endl
<< ”offset of int ” << sub(base,&my_struct.integer) << std::endl
<< ”offset of db ” << sub(base,&my_struct.db) << std::endl;
std::cout << ” pack is 2 ” << std::endl;
manken_s_p my_struct_p;
base = &my_struct_p.ch;
std::cout
<< ”offset of char ” << sub(base,&my_struct_p.ch) << std::endl
<< ”offset of int ” << sub(base,&my_struct_p.integer) << std::endl
<< ”offset of db ” << sub(base,&my_struct_p.db) << std::endl;
return 0;
}
ert@SEMERKAND:~$ g++ dnm.cpp
ert@SEMERKAND:~$ ./a.out
size of union: 8
size of struct: 16
size of packed struct: 14
size of char+int+double: 13
offset of char 0
offset of int -4
offset of db -8
pack is 2
offset of char 0
offset of int -2
offset of db -6
————————————————————————————————————————–
So, what is the moral of the story:
#pragma pack is a directive for compiler to determine the size of atomic unit for storing nonprimitive data types (struct for example) on memory.
If you set it to 2, chars in a struct will have a size [...]