Database Doubts   Independent houses near kukatpally | Apartments in Pragathi Nagar | AndhraVaani.com | Log Out | Topics | Search
Register | Edit Profile

Bewarse TalkTechnology - Talk Only Tech � Database Doubts Previous Next

Author Message
Top of pagePrevious messageNext messageBottom of pageLink to this 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:Edit PostDelete PostView Post/Check IP

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.
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

JAI Char JAI JAI Char

Sare babais thanks for ur points.....train ki time ayyindi
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

http://www.volny.cz/iprenosil/interbase/ip_ib_stri ngs.htm
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

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
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

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.
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

Sollei VARCHAR vadithe indexes vadatam BETTER For performance.
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

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.
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

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.
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

varchar e vadu...
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

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?
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

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.
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

>>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
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

varchar--- store variable length info
char--used for variables that have a fixed length
Top of pagePrevious messageNext messageBottom of pageLink to this message

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:Edit PostDelete PostView Post/Check IP

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