Re: [QUESTIONS] varchar vs text
От | Bruce Momjian |
---|---|
Тема | Re: [QUESTIONS] varchar vs text |
Дата | |
Msg-id | 199803012139.QAA26843@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: [QUESTIONS] varchar vs text ("Thomas G. Lockhart" <lockhart@alumni.caltech.edu>) |
Список | pgsql-hackers |
> > > > > Varchar currently (in 6.2.1 and below) takes up the entire length specified > > > > in the definition, despite the fact the value in it may actually be > > > > shorter. Text takes only the space taken by the value. > > > > > > Thanks for the clarification. In this case, what happens with varchar's > > > length if the original definition for that field leaves length undefined? > > > Does it behave like text in that case? > > > > You really shouldn't be doing that. Not sure what happens. Not a good > > idea: > > > > create table test (x varchar); > > ?? This was defined to be a varchar of unlimited length, much like, or identical > to, text. Should this now be disallowed? If so, we can fix the parser to disallow > it so people don't get misled. Oh, I didn't know. There really is no difference between varchar with no lenght, and text, but if it doesn't break anything, no problem. > > > > I also vaguely recall seeing a message last year about the use of indexes > > > in queries: that in [some circumstances] indexes built on varchar fields > > > don't get used and a sequential scan through all records takes place > > > instead. Is there any distinction between varchar and text here? > > > > Don't remember that. > > This was probably Bruce's improvements to allow indices on some pattern matching. > Doesn't make a distinction between these types in its behavior. Not sure what to say on this. I remember that issue, but not how it caused any problem. -- Bruce Momjian | 830 Blythe Avenue maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026 + If your life is a hard drive, | (610) 353-9879(w) + Christ can be your backup. | (610) 853-3000(h)
В списке pgsql-hackers по дате отправления: