Hacker News new | past | comments | ask | show | jobs | submit login

Why is Postgres lack of query hints not scary for people?



Because they are another form of coupling which is hellish to get out of if you want stuff to be portable, which as we found out when SQL pricing went through the roof is definitely a desirable feature in your application...

Also we use an ORM (NHibernate) which abstracts the entire query and schema away from us. We load/perf test that and get on with life. If there are any blockers, it's 99.9% architectural or loading related which we cover with test cases.

For us, the database is the hole we put our shit in when we don't want it in memory any more. Nothing more.


In your other comment, you mention that "our hefty DB cluster has lots of cores", and that this caused licensing to be much more expensive. Have you considered that maybe the abstractions and attitudes you're using have inflated the amount of hardware you need?

NHibernate, for example, can make it extremely easy to generate extremely poorly-performing queries. It often takes much more care and effort to have it generate mediocre queries than it takes to write good queries and any binding code by hand.

The "abstracts the entire query and schema away from us" and "database is the hole we put our shit in when we don't want it in memory any more" attitudes don't help reinforce the idea that you guys know how to use relational databases properly.

When teams go out of their way to remain as ignorant as possible about relational databases, while also using abstractions that are often inefficient, they shouldn't be surprised if their hardware needs (and their licensing costs, in some cases) balloon due to this inefficiency.


Actually no, it's load. We have 80 million page hits a day and each of these can run 10-20 queries on a 2TiB dataset. We're not a small outfit.

We use Nhibernate profiler to check our SQL output and all of our queries and make sure we're not doing anything stupid.

We know how to use relational databases, but it's expensive and hard representing our problem domain with them so an OO system is better.

We optimise later by switching the engine out to something cheaper. At least we CAN do this with an ORM abstraction without too much pain.

After all, premature optimisation is the root of all evil isn't it?


> We have 80 million page hits a day and each of these can run 10-20 queries on a 2TiB dataset.

Why is each page hit running 10-20 queries?


Because they are extremely complicated.


The question is, what's cheaper- labor for optimizing the queries + paying (possibly reduced) SQL server licensing, or keeping the "mediocre" queries + throwing in more hardware?


Hardware is cheaper. Running postgres!


Because they are a solution in search of a problem. Or more accurately, they are a problem in search of a problem.

http://wiki.postgresql.org/wiki/OptimizerHintsDiscussion


Hmm, I needed them a few times so far, specially when it comes to lots and complex sets of data and complex queries.

I had jobs run for a few hours on Dev only to take weeks (if I would have let them) on production, which was in ever aspect a beefier machine.


99% of the hinting I've seen people "need" was not needed at all, it was just the lazy way to temporarily work around a bad query plan. Other than actual bugs in the query planner, I can't even invent a hypothetical scenario where the tools postgresql already gives you to influence the query planner couldn't solve a problem.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: