My least favorite part of database design is the bit where you have to pick lengths for your char columns. Twenty years in and I'm still picking these pretty much by guessing. And when I guess wrong it causes really annoying problems further down the line. I love how SQLite doesn't make me do this - it just has a TEXT type which is always unlimited in length.
Postgres also has a TEXT type like this. Edit: I see mpolun left a similar comment here, but it looks like he has been mostly shadowbanned for about 8 years.
Old, Good Database Design
21–30 of 167 posts
Re: Old, Good Database Design
#22My least favorite part of database design is the bit where you have to pick lengths for your char columns. Twenty years in and I'm still picking these pretty much by guessing. And when I guess wrong it causes really annoying problems further down the line. I love how SQLite doesn't make me do this - it just has a TEXT type which is always unlimited in length.
Some database [versions] may also be unable to apply certain optimizations in certain cases, when TEXT is used (eg. temp tables on MySQL That doesn't prevent one from always using TEXT, and possibly, for most of the use cases (surely, if one uses SQLite, that's the case), the performance impact is not meaningful.
Re: Old, Good Database Design
#23My least favorite part of database design is the bit where you have to pick lengths for your char columns. Twenty years in and I'm still picking these pretty much by guessing. And when I guess wrong it causes really annoying problems further down the line. I love how SQLite doesn't make me do this - it just has a TEXT type which is always unlimited in length.
Postgres also has a TEXT type like this. Edit: I see mpolun left a similar comment here, but it looks like he has been mostly shadowbanned for about 8 years.
Yeah same. I don't have enough karma to vouch for their comment but I see no big reason that said comment should be dead. Their account is from 2012 and the vast majority of their few comments seem to be contributing to the conversation. Their first dead comment is also from 2012 but at a glance said comment is the only one that stands out as not contributing much to the conversation. And that's being harsh even – I've probably made less substantial comments in the past myself. Yet like 30% of their 3 pages of comments are dead. And looking at their submissions they have ever only submitted 3 stories, 2 of which appear to be from a domain that they themselves control. Hardly enough to be subjected to having so many of their comments killed I think. Though of course there might be other factors at play, but from what I see on their profile page I see nothing bad enough to warrant this.
Re: Old, Good Database Design
#24Re: Old, Good Database Design
#25I end up keeping numeric data as text when I'm ingesting an external data source that I don't trust not to change ID format on me. They're all numeric now, but the format could change, and the actual numeric value of the ID is not important at all.
Re: Old, Good Database Design
#26Earlier quoted context omitted.
Postgres also has a TEXT type like this. Edit: I see mpolun left a similar comment here, but it looks like he has been mostly shadowbanned for about 8 years.
Just for general interest, how can you see their comment or assert they have been shadowbanned?
Go to your profile and ensure you have showdead set to yes.
> assert they have been shadowbanned
See https://news.ycombinator.com/threads?id=mpolun and check out how many of their comments are showing as dead in combination with the contents of said comments. (The step above about setting showdead to yes might be required before you follow said link in order to actually see the dead comments). Almost every single one of the dead comments is contributing to the conversation. This is indicative of a shadow ban. HN users would not be downvoting the vast majority of these comments I think.
Re: Old, Good Database Design
#27Most people, though, choose nosql alternatives because they're too lazy to learn how to model data.
Re: Old, Good Database Design
#28> we should keep numeric data in “integer”, “numeric” fields I end up keeping numeric data as text when I'm ingesting an external data source that I don't trust not to change ID format on me. They're all numeric now , but the format could change, and the actual numeric value of the ID is not important at all.
E.g. back when I thought I was super smart, on one project I made the credit card cvv a number. Except they can start with 0. Whoops.
Re: Old, Good Database Design
#29Earlier quoted context omitted.
Postgres also has a TEXT type like this. Edit: I see mpolun left a similar comment here, but it looks like he has been mostly shadowbanned for about 8 years.
> Edit: I see mpolun left a similar comment here, but it looks like he has been mostly shadowbanned for about 8 years. Yeah same. I don't have enough karma to vouch for their comment but I see no big reason that said comment should be dead. Their account is from 2012 and the vast majority of their few comments seem to be contributing to the conversation. Their first dead comment is also from 2012 but at a glance said…
Re: Old, Good Database Design
#30If one of the purposes of relational databases is data modeling, I've always wondered why there aren't good semantics for sum types. The real world is full of them, but databases can't express them. When I bring this up, some people respond that this is the purpose of ORMs; however, this implies that we have an arbitrary bifurcation in which some of the processing happens efficiently in SQL and anything that depends…
Huh?
Creating a data model before creating a database, is like writing an outline before writing an essay. It organizes your thoughts and gives structure to what you are about to do. Once you have a data model, you can then implement it using whatever database technology you choose.
If you don't start with a data model, you literally don't know what you are doing.