postgresql - String field length in Postgres SQL -
i have string filed in sql database, representing url. url's short, , long. don't know waht's longest url might encounter, on safe side, i'll take large value, such 256 or 512.
when define maximal string length (using sqlalchemy example):
url_field = column(string(256))
does take space (storage) each row, if actual string shorter?
i'm assuming has implementation details. i'm using postgresql, interested in sqlite, mysql also.
usually database storage engines can many thing don't expect. basically, there 2 kinds of text fields, give hint go on internally.
char , varchar. char give fixed field column , depending on options in sql session, may receive space filled strings or not. varchar text fields maximum length.
varchar fields can stored pointer outside block, block keeps predictable size on queries - implementation detail , may vary db db.
Comments
Post a Comment