Better HN
topnewbestaskshowjobs
Log inSign up

wireprotocol

7,244 karma · joined Sep 25, 2010 (16y ago) · 2,593 submissions

Submissions

comment 14y ago · link · parent

I'd really like to see btrfs start to stabilize and become more mainstream, but everything still seems to say that it's experimental.

The main reasons that I want it on my desktop are:

  * easy backups
  * checksums
  * maybe it will become integrated with package manager (I'm on ubuntu) so that I can roll back package updates if they don't work properly

comment 14y ago · link · parent

I wasn't referring only to long running transactions. Indexes are clearly a way of reducing the working set (at least in a practical sense) but also vital for workloads with many short transactions.

I was not criticizing mongo per se, I was criticizing this post and other misguided statements about the working set as it relates to database software.

comment 14y ago · link · parent

It's not about "hating", or at least I hope it's not.

NoSQL, in many ways with MongoDB leading the charge, came on to the scene very quickly with a lot of support on HN. When action outpaces education, then it's natural to expect education to play catch-up for a while, which is what's happening now.

Some of it is education by 10gen, some by users who made mistakes (the leading cause of education), and some by traditional database people who want to highlight the lessons learned that might have been missed by 10gen or mongo users.

Generalizing all of this as "hate" is not productive.

comment 14y ago · link · parent

"Getting your working set in memory is one of the most difficult things to calculate and plan for with MongoDB."

I am a little bothered when I see a working set described as though it was a property of the user or workload.

A large part of database research has gone into allowing the user or the system to make the working set smaller. An obvious example is an index, which makes the working set smaller if you don't mind a random I/O or two per lookup (of course, that only works for indexable queries).

There are also many operations in a database which try to work within a limited amount of memory, and therefore must have a small working set regardless of the data size. Sort and HashJoin are two examples. HashJoin doesn't tell you what the working set of your data is, you tell it and it works as efficiently as it can in that amount of memory.

And you can design your data layout to have a smaller working set (again, so long as you allow a few disk accesses outside the working set). Normalization and vertical partitioning (i.e. splitting a table up into several tables with fewer columns each) can help here.

So, the "working set" isn't some passive constant that can't be managed.

comment 14y ago · link · parent

"Many suggest this default is a good way to get favourable benchmarks but there are no official ones so I don’t think that’s relevant."

Sure it is. People download MongoDB, run some simple workload against it, and see how fast it is. It's not an official benchmark, but it's still a strong part of the marketing message.

So, if those people don't understand the significance of sync/async, they may be getting a false impression of the speed.

comment 14y ago · link · parent

I think blaming the user here is partially valid (he didn't read the docs), but that's not the whole story.

There is a discontinuity between the ease-of-use story and the blame-the-user story, regardless of how well documented the async insert behavior is.

And it doesn't have to be this way. There are ways of designing interfaces, APIs, and even naming that go a long way to prevent your users from shooting themselves in the foot.

Take postgres. It also supports at least a couple kinds of async insert, one of which is a part of libpq (postgres C client library). It's called "sendQuery" and it's documented under the "Asynchronous Command Processing" section. It's hard to imagine a user trying to use that and expecting it to return an error code or exception. Even if the user doesn't read the docs, or reads some fragment from a blog post, they will still see that the name suggests async and that it returns an int rather than a PGResult (which means it obviously doesn't fit into the normal sync pattern).

There is no reason mongo couldn't be clear about this distinction -- say, rename "insert" to "async_insert" and have "insert" be a wrapper around async_insert and getLastError. But instead, it's the user's fault because they didn't read the docs.

Careful API design is important to reduce the frequency of these kinds of errors. In postgres, it's relatively hard to shoot yourself in the foot this badly in such a simple case. I'm sure there are gotchas, but there is a conscious effort to prevent surprises of this sort.

comment 14y ago · link · parent

"It's been stated many times already: Use the right tool for the right job."

The problem with that argument is that things change, and it's not always obvious what problems you will need to solve when you start a project.

RDBMSs are backed by extensive theory as well as decades of product hardening, development of expectations and best practices, and battle-tested in production environments. They are explicitly designed as general-purpose systems. That means that when your needs change and you need to adapt, an RDBMS likely provides features that make that transition work smoothly and avoid breaking applications.

At this time, those things are not true of MongoDB, so it is somewhat more specialized. That's OK, but it means that you need to be more careful about using it than, say, postgres. Trying to put MongoDB on equal footing with postgres and say "choose the right tool" is an oversimplification.

I think it's perfectly reasonable advice to start with SQL unless you have specific reasons that you think something else will be a better fit.

comment 14y ago · link · parent

"shouldn't index hints be supported"

Index hints already are supported in multiple different ways:

http://thoughts.davisjeff.com/2011/02/05/why-postgresql-alre...

"I see this as a case of devs overriding users"

I don't think that's an accurate characterization. I'm sure there are some improvements to hinting that would be approved if they are well thought out and don't introduce major maintainability concerns, etc. Someone just needs to do the work required, including considering many alternative approaches which may be radically different from what you typically think of as hints.

The proposals that tend to fail are ones that follow an argument pattern like "Oracle does it this way... therefore it is good... therefore postgres should do something similar".

I'm not trying to dismiss your point at all. I think it's important that postgres give users as much power as possible, and a part of that is having some control over the optimizer without waiting for a new release. Postgres offers that in some innovative ways, but it could do better.

comment 14y ago · link · parent

I'll be speaking on this use case next week at Postgres Open ( http://postgresopen.org ) as part of a larger demo of temporal databases in postgresql.

Jonathan S. Katz will also be presenting on Range Types.

comment 14y ago · link · parent

Oh, interesting.

That's a problem for very wide fields, which aren't going to be handled very well even using \x.

\x was meant to handle large numbers of fields, or slightly wider fields.

But you're right, maybe that could be cleaned up a little more.

comment 14y ago · link · parent

It's a display feature in the "psql" client program.

Normal result:

     column1 | column2 | column3 
    ---------+---------+---------
           1 | a       |     9.9
           2 | b       |    19.9
    (2 rows)
Using \x:

    -[ RECORD 1 ]-
    column1 | 1
    column2 | a
    column3 | 9.9
    -[ RECORD 2 ]-
    column1 | 2
    column2 | b
    column3 | 19.9
The first form is tabular and works well for a few columns; but doesn't work well when there are many columns, because the lines start to wrap. So you use \x for wide tables to make the result readable (but, obviously, fewer rows are shown at a time).

Using "\x auto" automatically chooses which format to use based on your terminal width.

comment 14y ago · link · parent

Regarding the inheritance features, he's been writing an extensive series on the subject recently:

http://ledgersmbdev.blogspot.com/2012/08/intro-to-postgresql...

(though he should provide forward/backward links in the posts -- as it stands you need to find the other parts in the archive links on the right)

comment 14y ago · link · parent

"Consider a database of actual, real world, gravestone inscriptions. If someone's gravestone stone has "1890-02-30" inscribed on it, I know thats wrong but I don't care, I need to store it exactly as is for historical purposes, I don't want a DB crash or need to recompile postgres to accept it, I don't want to force the users to falsify gravesite records, I don't want to have to store as a CHAR or VARCHAR and have to write my own date handling routines in my app..."

I think this is a crucial point of distinction between the two philosophies: structure defined in the query; and structure structure defined before data is loaded.

Structure defined in the query is the more obvious approach. You collect all of the data, and write queries over that data that handle all the cases. The queries often become quite complex and error-prone. Even if the query is slightly wrong, the result generally looks about right. Queries may take a long time to develop and get right, and may react badly to new data that is loaded (e.g. "I thought that was a number field, but now it has letters"). This approach is useful when you are trying to interpret the input data in several different ways -- in other words, when the query is helping you determine the nature of the data you have.

Defining structure before loading is generally more robust and less error-prone, but requires planning that may be frustrating to people just trying to get their hands on the data. The queries generally don't have branches or special cases, so usually if the query runs at all, it will give the right answer. If someone is trying to file an expense, and the receipt says Feb 30th, the accountants still don't want to see the expense as happening on Feb 30th. If they let it in, it could (potentially) break all of their other queries by creating inconsistencies (e.g. it happens after one month is closed and before the next is opened, and it causes the accounts to be out of balance somewhere). So, the person filing the expense has some extra work to do -- maybe they need to look at their bank statement to see what day it really happened, and add a note saying the receipt has the wrong date, in case anyone does an audit.

Broadly speaking, the first philosophy is easier for writers of data, and people writing the applications that help people input data (in part, because you never have to tell the user that the data is wrong, and they need to reexamine their records). The second philosophy is easier and more reliable for the people querying the data, but harder for the people trying to input data and the people trying to write applications to help input data (because they have to handle more error cases and try to provide context so the user can correct them).

In your example, it all depends on what you are trying to ultimately do with the data you collect. The easiest thing to do is to take the data in an even more raw form: just have people take pictures and automatically upload them. But it's awfully difficult to query pictures, so you have to demand a little more structure at load time if you want to query the data at all. I'm not sure what the right balance is for you -- maybe they have a 13th month or a 32nd day, so you should just ask for 3 integers. Or maybe people put question marks or ranges (e.g. born sometime between X and Y), and you want to represent those as well. But the more of that you do, the more burden you put on query writers, and the higher the chance that you get wrong results.

comment 14y ago · link · parent

"I'm pleased to see that my theory stands up to computational modelling,"

Was anyone else disturbed by that statement?

We all know that models are heavily dependent on parameters, and by tweaking them you can get whatever result you want. The only use a model has is when it shows a pattern of predicting observations in the real world. In other words, a model is essentially a theory about the way the world works.

So "stands up to computational modeling" strikes me as a very unscientific thing to say -- kind of like saying "my theory stands up to his theory". Theories should stand up against testing and observations in the real world.

comment 14y ago · link · parent

"And I am talking about native JSON support as a first class citizen."

Wait a week for 9.2, please.

comment 14y ago · link · parent

"Now if you need either [Sharding or JSON] (very common) PostgreSQL is a non-starter."

Instagram used sharded postgres, and they certainly started up.

http://instagram-engineering.tumblr.com/post/10853187575/sha...

Native JSON support is coming in 9.2 (being released very soon) and will rapidly improve.

PostgreSQL is being used by startups and major enterprises alike to great effect. If you have any interest in it, I encourage you to dive in to some real problems and see how postgres can help you solve them.

Yes, your criticisms may be valid, and postgres is always improving. But if you keep an open mind and actually try to solve real problems with it using all of the tools it has to offer, you may be pleasantly surprised.

comment 14y ago · link · parent

"I don't know why people defend PostgreSQL on this and aren't pushing for a more coherent, in-built solution."

I specifically said that I wasn't trying to make excuses, and that people are actively working on built-in multi-master replication.

I encourage you to keep pushing though. People have been finding weaknesses in postgres for a long time and those weaknesses have been disappearing quickly with releases delivered every year. All the while, some great innovations have been coming along that no other database has.

I've been involved in postgres for a long time and it's always interesting to think back on the way features have been demanded and then delivered. After multi-master, there will be another round of must-haves. But in the meantime, it's important to also work on new innovations that might ultimately be more important to the cloud use case than multi-master is.

comment 14y ago · link · parent

"What system would encourage the most able technocrats, instead of the most ruthless?"

In general, I think in the US, we torture politicians and bureaucrats far too much.

However, I don't think putting smart people in government is going to solve all of our problems, and it could make things much worse (I'm serious when I say that -- sometimes smart people make extremely unwise policy decisions).

I think, what we really need, are people that:

* Have not publicly stated a bunch of opinions. The more clearly you state an opinion in public, the more it becomes a part of your identity no matter how ridiculous.

* Have been wrong enough times that they aren't afraid of being wrong one more time. They expect a high likelihood of being wrong, so build safeguards into their policies for when they don't work.

* Are willing to cede power. Maybe some federal laws could be state laws, instead? Or maybe state laws could be local laws? Or maybe they don't need to be laws at all, and the goal can be accomplished in some less-forceful way.

comment 14y ago · link · parent

Wasn't there an episode of The Simpsons about this?

http://en.wikipedia.org/wiki/They_Saved_Lisas_Brain

comment 14y ago · link · parent

"A more politically sensitive approach to problems and issues, on the other hand, often leads to positions that simply don’t jibe with the facts, no matter how delicately phrased. Examples as diverse as stem cell research and the economic stimulus abound."

It bothers me that the author states the existence of examples, without actually telling us what the example is.

Reading between the lines, it seems like the author is implying that some (unstated) policy positions related to stem cells and the economic stimulus are refuted by scientific facts.

Although science might inform people on either issue, or cause people to change their minds, I don't see how science or logic could make strong conclusions in either case. That the author implies that science can answer these questions is a big part of the reason that people are skeptical of scientists in government.

EDIT: I suppose questions about economics could, in theory, be answered in a compelling way by science. But in reality, the economy is so complex that I just don't regard an economic opinion by an economist as anything more than an informed opinion. Interesting, but it's not like it's a repeatable experiment that anyone can verify.

comment 14y ago · link · parent

"The database is just an API."

APIs matter a lot. In my opinion, software engineering could almost be defined as the practice of designing good APIs.

I happen to think postgres, and it's brand of SQL, are great APIs. It has a lot to offer beyond a lowest-common-denominator API that works over any database.

comment 14y ago · link · parent

I find postgres more pleasant and faster to develop in than mysql. It can help you avoid the need for a lot of application code, and feel more confident in your solution. I can't say any one thing that will convince you; you basically have to dive in and try doing things the "postgres way" (i.e. don't try to transplant a mysql mindset on postgres, or you will be disappointed). Try out the various features available, and see which ones might help you develop faster or avoid problems.

Postgres has strong support for single-master replication, including synchronous (several levels) or async, cascading, etc. Read scaling and HA are well covered.

What postgres doesn't have built-in is sharding or multi-master. I'm not trying to make excuses for this, but here are some thoughts to put things in perspective:

* There is active development on multi-master in postgres.

* You need to have quite a large database to not physically fit on a single node.

* By the time you really need to scale out writes beyond a single node, you may be very interested in the fine details of what's happening, and the flexibility and myriad options available in postgres may be just what you need.

* If you focus too much on one feature, it starts to seem more important than it is. It's easy to forget the flaws in the feature in other products; and the fact that businesses existed at high scale before the feature existed. Lack of a feature you want is more like a hurdle, not a dead-end.

comment 14y ago · link · parent

You might take a look at Postgres-XC (http://postgres-xc.sourceforge.net/), and see if it meets your needs.

comment 14y ago · link · parent

"As a trivial example, someone needs to pay the author, which is typically done through royalties. But the publisher also needs to get paid, as does anyone the publisher employs."

Those aren't marginal costs.

comment 14y ago · link · parent

"allowing you to not only add a column without locking the table"

To be more clear, the actual advantage is that adding a column in postgres is an O(1) operation if the default value is NULL. It still requires taking a lock, but for many workloads you won't notice it. You still need to be aware of it though, because it can cause problems if you have long-running transactions.

comment 14y ago · link · parent

"setting up and "using" SQLite is as easy as any other database"

That's exactly the problem. If it's easier, then maybe I'll use it. If it's just as easy, but does less, I have no reason to bother using it, for two reasons:

1. There is non-zero risk that I will need one of the other features.

2. Even if I don't, why would I want to spend time learning something if it isn't better (at something) than what I already know how to use?

I haven't seen any compelling reason to use SQLite outside of the mobile or embedded space.

"over-kill"

What do you mean by that, and why is it bad?

comment 14y ago · link · parent

Disclaimer: It's been a while since I tried to use SQLite for anything.

I've never really felt that it was actually easier to use than a client/server DBMS. I can imagine that it's good for some kinds of embedded applications, but for normal web applications I don't see any improvement in usability. Juggling files is not any easier than setting up a connection.

And there were always annoyances associated with the simplicity. All those "complex features" in a real DBMS turn out to be useful sooner than you think (and I don't mean "once in production" I mean while still in development). Even the simplest applications can usually benefit from good support for dates and times.

I think SQLite just drew the line in the wrong place for most applications (although it may serve a niche quite well). Oversimplification requires the developer to reinvent, which results in a much more complex system overall (or one that at least requires more work to develop and maintain). Key/value stores have similar problems for general-purpose application development.

comment 14y ago · link · parent

"it seems more likely to me that it was simply a mistake, and one they'll walk back at some point."

How do you explain removing access to the source repository then? Or the fact that the documentation is not free to redistribute?

comment 14y ago · link · parent

OSM uses postgres: http://blog.cleverelephant.ca/2009/04/openstreetmap-moves-to...

comment 14y ago · link · parent

In a way, it's symbolic: it's saying that postgres is treating JSON and the developers that use it as first-class citizens.

Regardless, it will quickly and steadily improve.

1
767778
87