Author |
Message |
Manishi
Mudiripoyina Bewarse Username: Manishi
Post Number: 3827 Registered: 06-2004 Posted From: 129.9.163.106
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 9:44 am: | |
Gula, This is my opinion in terms of DB2 In general VARCHAR data types should be used for columns containing long descriptions or memos that are not referenced very often. 50 bytes is probably the smallest length you would want to use for a VARCHAR column. DB2 does have to allocate some additional bytes for each row with variable length columns to keep track of the varying length data, so some of the space savings will be consumed by these "extra tracking" bytes. Due to this overhead, the space savings would only be noticeable on tables with a large number of rows. Fcators to Consider in deciding between Varchar and Char. 1.The amount of variability must be considered. A column that only varies between 8 and 10 bytes does not generate any savings whereas a column that has 95% of its values at 10 bytes and the other 5% at 100 bytes would generate great savings. The bottom line is Greater variability provides greater incentive to use Varchar. 2.Carrying extra bytes by using a Char instead of Varchar can produce the following cons a.) Additional space requirements for both table and any indexes containing the column. b.) Larger rows mean fewer rows per page, which means fewer rows delivered for each physical read, including when prefetching. c.) Larger rows mean increased sort costs and memory requirements when querying the column. d.) Larger rows mean fewer rows can be in the bufferpools, reducing buffer hit ratios. e.) Larger columns mean increased costs in delivery of result sets. Larger columns mean increased costs when using the column as a local or join predicate since more bytes have to be compared. |
Gula
Mudiripoyina Bewarse Username: Gula
Post Number: 4054 Registered: 06-2004 Posted From: 69.109.216.225
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 9:13 am: | |
JAI Char JAI JAI Char Sare babais thanks for ur points.....train ki time ayyindi |
Vision
Kurra Bewarse Username: Vision
Post Number: 739 Registered: 06-2005 Posted From: 192.63.80.98
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 9:05 am: | |
http://www.volny.cz/iprenosil/interbase/ip_ib_stri ngs.htm |
Gula
Mudiripoyina Bewarse Username: Gula
Post Number: 4053 Registered: 06-2004 Posted From: 69.109.216.225
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 9:00 am: | |
yep index vadakapothe sana teda vasthadi...... ee point meda naaku maa dost ki oka pight ayyindi....what he claims is in implementation of these 2 datatypes, if the length is less than the size of the pointer he may save directly and dont use as a pointer else he can have a pointer, so use only varchar anytime. also even is ur length is greater than pointer size and u know its fixed length like some ID, use char for performance |
Vision
Kurra Bewarse Username: Vision
Post Number: 738 Registered: 06-2005 Posted From: 192.63.80.98
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:58 am: | |
this is where indexing comes into play, as well as other nifty search algorithms (binary searching for example). Ultimately, it depends on the RDBMS implementation, some are better than others. |
Vision
Kurra Bewarse Username: Vision
Post Number: 737 Registered: 06-2005 Posted From: 192.63.80.98
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:56 am: | |
Sollei VARCHAR vadithe indexes vadatam BETTER For performance. |
Aavakaaya
Kurra Bewarse Username: Aavakaaya
Post Number: 906 Registered: 04-2004 Posted From: 195.220.151.50
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:55 am: | |
U hav a point...but varchar saves lot of space when we are not certain about the length of the variable. Regarding the search time Indexing saves a lot of time. |
Gula
Mudiripoyina Bewarse Username: Gula
Post Number: 4051 Registered: 06-2004 Posted From: 69.109.216.225
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:54 am: | |
vision babai what i'm thinking is when char is defined, a fixed amount of space as per definition is left in the block when the record is created where as for varchar a space for pointer is left. so when a value has to be saved, the location value can be saved in the space for it idi righta wronga? if its correst, even if the length is variable but the max size is less than that of pointer, then use char. |
Vision
Kurra Bewarse Username: Vision
Post Number: 736 Registered: 06-2005 Posted From: 192.63.80.98
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:53 am: | |
varchar e vadu... |
Gula
Mudiripoyina Bewarse Username: Gula
Post Number: 4050 Registered: 06-2004 Posted From: 69.109.216.225
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:50 am: | |
KR babai aa dokkulo answer directgane kanipisthondi sare ippudu naaku oka field undi adi max 4 chars paduthundi......but variable in length......varchar vadathava char vadtahava enduku vadtahavu? |
Vision
Kurra Bewarse Username: Vision
Post Number: 733 Registered: 06-2005 Posted From: 192.63.80.98
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:50 am: | |
Avakaya mama char is better than varchar...because of this. Databases are held in files on a server, which are then read by the RDBMS. When a search has to be conducted, the RDBMS uses lots of shortcuts to find the data quickly. Using char is one such short-cut. Because all the fields are of a fixed length, the RDBMS can find the exact value for a specific record instantly. VARchar has a variable length which makes finding a specific record harder. |
Aavakaaya
Kurra Bewarse Username: Aavakaaya
Post Number: 905 Registered: 04-2004 Posted From: 195.220.151.50
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:48 am: | |
>>difference in implementation of char and varchar varchar better. Ex: Vikram simple 'Char' chesthe telugollu evaru pattinchukoledu ... ippdu varchar (variety char) cheyyagaane pattukuni vadaladam ledu
|
Vision
Kurra Bewarse Username: Vision
Post Number: 732 Registered: 06-2005 Posted From: 192.63.80.98
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:48 am: | |
varchar--- store variable length info char--used for variables that have a fixed length |
Gula
Mudiripoyina Bewarse Username: Gula
Post Number: 4049 Registered: 06-2004 Posted From: 69.109.216.225
Rating:N/A Votes: 0(Vote!) | Posted on Tuesday, July 12, 2005 - 8:44 am: | |
1) What are advantages and disadvantages of having 1-1 relation tables in database. 2) difference in implementation of char and varchar. which would be better choice and when. i can not reply after 20-25 mins but can see the thread dont misunderstand. andariki hi |