Live data from Hacker News

Tips for a Healthier Postgres Database

blog.crunchydata.com

21–30 of 87 posts

Re: Tips for a Healthier Postgres Database

#21
+1

Ran into a pathological case where a query that usually took 10-20ms would sometimes, semi-randomly, take > 15 minutes (while the corresponding PG process server-side is running at 100% CPU)

Explain showed a dramatic query plan change, which led us towards bad table statistics.

Re: Tips for a Healthier Postgres Database

#22

I would love to drop MySQL/MariaDB and go with PostgreSQL, but information like this makes me nervous that I would setup a footgun and be constantly debugging things because I am not a DB admin expert. Anyone care to comment on how PostgreSQL works out of the box without being an expert? (I've run MySQL/MariaDB for almost 20 years and there are very few issues I've been surprised by)

I converted a large MySQL DB to PostgreSQL in 2004 and never looked back. Think about how many improvements have occurred in Pg releases since that time and the availability of information. It took my team about six months to do the conversion as there were any number of type conversion problems due to programming assumptions and loose typing in MySQL at that time. There's also an excellent support community on IRC at Freenode (you can google it) and they are very helpful to people of any level of experience.

Optimizations as presented by many are not needed right up front and you'll learn them as you go along. Good luck!

Re: Tips for a Healthier Postgres Database

#23
As someone who's used MySQL for 17 years and dabbled a little in Mongo is there any reason to try and switch to Postgres?

Obviously I love learning new things, but I've just never felt inclined to try it out, whereas I'm always jumping between other languages and frameworks within them. Not sure why that is.

Re: Tips for a Healthier Postgres Database

#25

As someone who's used MySQL for 17 years and dabbled a little in Mongo is there any reason to try and switch to Postgres? Obviously I love learning new things, but I've just never felt inclined to try it out, whereas I'm always jumping between other languages and frameworks within them. Not sure why that is.

Honestly, after using PG for a couple of years it’s more than a little painful to go back.

You don’t realize how limited you are until you really get into all the additional capabilities that PG brings…and then have them unavailable.

Re: Tips for a Healthier Postgres Database

#26
post #5

I would have said, check your shared buffers memory and concurrency are configured right for the environment you are running on. The defaults are wrong for most production environments and the right values are highly server dependent. If you haven't specifically tuned them for your production server, chances are they are wrong and you are leaving substantial memory and / or concurrency on the table.

How would one go about determining the right values for these settings?

Looks like crunchdata has blog posts for that too!

https://blog.crunchydata.com/blog/optimize-postgresql-server...

Re: Tips for a Healthier Postgres Database

#27

As someone who's used MySQL for 17 years and dabbled a little in Mongo is there any reason to try and switch to Postgres? Obviously I love learning new things, but I've just never felt inclined to try it out, whereas I'm always jumping between other languages and frameworks within them. Not sure why that is.

I think Postgres tends to have a bigger SQL dialect and it's faster on the same hardware (afaik, based on light testing)

MySQL clustering and operations tooling seems much better. No vacuums to worry about

Re: Tips for a Healthier Postgres Database

#28

As someone who's used MySQL for 17 years and dabbled a little in Mongo is there any reason to try and switch to Postgres? Obviously I love learning new things, but I've just never felt inclined to try it out, whereas I'm always jumping between other languages and frameworks within them. Not sure why that is.

This former MySQL dev says:

> MySQL is a pretty poor database, and you should strongly consider using Postgres instead.

https://web.archive.org/web/20220104181634/https://blog.sess...

Re: Tips for a Healthier Postgres Database

#29
post #6

Earlier quoted context omitted.

I read this as "maybe a few (which are the ones automatically created on primary keys)", as opposed to redundant indices created on primary keys.

I would agree IFF there wasn't the 'maybe'. If that word wasn't there I would read it as having not many tables in the beginning and thus not many primary keys and thus not many primary key indices. 'maybe' changes that dramatically unfortunately.

I don't disagree, but Mr. Kersteins has quite the track record of Postgres excellence, so he gets every benefit of the doubt from me. I feel quite certain he understands how primary keys work! I'm sure this was just a miswording.
Post reply on HN