News for hackers. Stuff that matters.
Re:At 22 years old, Postgres might just be the most advanced... by ernst_klim on Wednesday December 05, 2018 @01:45PM (#18611151)
I've dived into the postgres code recently and it was incredible. Lisp legacy is all over the place, it's literally lisp in C, though unlike many "Langname-styled C" codebases it looks really clean and organic.

I'm still confused how people prefer oracle [1] other postgres.

[1] https://news.ycombinator.com/item?id=18442941

Re:At 22 years old, Postgres might just be the most advanced... by irrational on Wednesday December 05, 2018 @02:24PM (#18611550)
Seriously. After using Oracle for 15+ years, moving to Postgres has been amazing. Just moving from clob to text has nearly brought me to tears of happiness. Nearly all of our complex sql queries are simpler in postgres. The documentation is light years better.
Re:At 22 years old, Postgres might just be the most advanced... by PaulHoule on Wednesday December 05, 2018 @02:15PM (#18611451)
Postgres has led the world in trash-talking other databases for 22 years.

I used to call it CrashGreSlow back when Mysql was maintained. Postgres had a manifesto which trash-talked Oracle but it was not a reliable product at that time. Maybe the people who said it was fast were running it on ram disks with fsync turned off or something.

After mysql got bought by Sun and put on ice, postgres caught up with the hype and now it is pretty reliable. That wasn't always the case.

Re:At 22 years old, Postgres might just be the most advanced... by evanelias on Wednesday December 05, 2018 @05:50PM (#18613524)
MySQL has been continually developed and maintained. At no point was it ever "put on ice". There are more developers devoted to it in recent years than at any point in its history.

Recent major versions have provided substantial enhancements to performance, replication, JSON/document support, and observability, to name just a few.

Re:At 22 years old, Postgres might just be the most advanced... by threeseed on Wednesday December 05, 2018 @02:22PM (#18611525)
Seriously though this is true especially from their users.

It is never just PostgreSQL is a great database. It’s always that MySQL, Oracle, MongoDB and the hundreds of NoSQL databases are all unusable junk with no unique benefits.

Re:At 22 years old, Postgres might just be the most advanced... by PaulHoule on Wednesday December 05, 2018 @06:36PM (#18613898)
Oracle is OK if you can afford it and afford a nice battery backed storage array that (truthfully) fsyncs quickly.

MongoDB is crap.

I think the people who use Arangodb don't talk about it because they see it as a competitive advantage.

Right now I am working on an abstraction layer for document databases and using couchdb side by side with Arangodb. I guess I'll have to write a N1QL parser to go with my AQL parser.

The database I have the most fun with is SQLite. It is single-user, which means you can't log in with the SQL monitor when your program is running, but if you can accept that it's just great.

Re:At 22 years old, Postgres might just be the most advanced... by weberc2 on Wednesday December 05, 2018 @03:06PM (#18611928)
I've never heard this, but I don't know any hardcore database folks either. Mostly it's just "I need a SQL database for my application and Postgres seems to be a good default" (note that I mostly roll with a Linux/Unix crowd, otherwise it'd probably be the same thing except s/Postgres/SQLServer).
Re:At 22 years old, Postgres might just be the most advanced... by gtsteve on Wednesday December 05, 2018 @02:37PM (#18611687)
MySQL is still under development, and there are numerous forks. I use it for my company; it's still a very good database option, albeit perhaps a little basic.

However the fact that it's owned by Oracle does make it a little bit scary, even though we have no exposure to their code or anything linked at all. I sort of wish we'd chosen Postgres instead.

Re:At 22 years old, Postgres might just be the most advanced... by PaulHoule on Wednesday December 05, 2018 @06:25PM (#18613802)
When Sun bought mysql they promptly stopped development. Around that time they were also neglecting Java.

Oracle has been a reasonable steward of mysql. They started making releases again. They haven't really moved it forward but I am sure they are taking care of their customers.

So far I haven't been impressed with mariadb and the other forks. For instance I would download it because I heard some hype but the installer didn't work.

Re:At 22 years old, Postgres might just be the most advanced... by evanelias on Thursday December 06, 2018 @12:13AM (#18615614)
> When Sun bought mysql they promptly stopped development.

This simply is not true. I personally know a bunch of engineers who worked for MySQL AB and stayed on through the Sun and then Oracle acquisitions, and worked on MySQL that entire time.

Additional source: Sun acquired MySQL AB in early 2008. MySQL 5.1 was released in late 2008, and major releases continued on a cadence of every 2 to 2.5 years to this day. You can verify this via release notes, or via Wikipedia, among other sources.

> They haven't really moved it forward

This is purely a matter of opinion. From my own perspective, as someone who has been using MySQL for 15 years, I see substantial ongoing improvement in each major release.

If MySQL was as stagnant as you claim, why would the majority of the largest internet properties continue to rely on it as their primary data store?

Re:At 22 years old, Postgres might just be the most advanced... by jstimpfle on Wednesday December 05, 2018 @01:53PM (#18611240)
What is "Lisp style C"? Can you link an example?
Re:At 22 years old, Postgres might just be the most advanced... by mschaef on Wednesday December 05, 2018 @02:19PM (#18611495)
I tend to think of George Carette's SIOD Scheme interpreter when I think of "Lisp style C":

    LISP difference(LISP x,LISP y)
    {if NFLONUMP(x) err("wta(1st) to difference",x);
     if NULLP(y)
       return(flocons(-FLONM(x)));
     else
       {if NFLONUMP(y) err("wta(2nd) to difference",y);
        return(flocons(FLONM(x) - FLONM(y)));}}
http://people.delphiforums.com/gjc/siod.html

Of course, that's a Scheme interpreter, so it might be at least a little expected.

Re:At 22 years old, Postgres might just be the most advanced... by nicklaf on Wednesday December 05, 2018 @02:03PM (#18611347)
I can't find it, but I remember seeing a linked list library for C, which supported a functional style like Lisp. I don't know how closely it was related to S-expressions, but I'd be interested if somebody could help me remember what I'm thinking of here.
Re:At 22 years old, Postgres might just be the most advanced... by kazinator on Wednesday December 05, 2018 @02:06PM (#18611375)
I'm taking a look at this now and can't make the same conclusion. For instance, the "bag-like" List and ListCell stuff is completely non-Lispy:

https://github.com/postgres/postgres/blob/master/src/backend...

Mind you, I'm biased because I've written a fair amount of actual "Lisp style C", e.g.:

http://www.kylheku.com/cgit/txr/tree/regex.c?id=2938a0d7e64e...

My detector for "this C is Lispy" has a rather high threshold / low gain.

Re:At 22 years old, Postgres might just be the most advanced... by neilc on Wednesday December 05, 2018 @02:15PM (#18611457)
Yeah, we replaced the old Lisp-style List implementation with a different implementation a while ago: https://github.com/postgres/postgres/commit/d0b4399d81f39dec...

You can still see the Lisp heritage in a few places, but overall I wouldn't say Postgres is "literally lisp in C".

Re:At 22 years old, Postgres might just be the most advanced... by kazinator on Wednesday December 05, 2018 @03:06PM (#18611936)
I see that this diff contains a lot of fluff: in many places, functions and variables are changing names while the code which uses them remains the same.

In code that truly embraces "Lispy" lists, you cannot switch to an encapsulated list representation without making substantial changes to the code. For instance if you have any cdr recursion going on, that will have to be restructured, because a bag-style list doesn't have a cdr that is itself a bag-style list. (Perhaps the function has to be split into an external one that takes the List and then a local recursive part that works with the ListCell.)

I would say that to a fair extent, it looks to me as if the code anticipated a future retargeting to a different list representation, whereas the "Lispy" approach is to embrace a particular list representation.

Lisp programs sometimes need to improve the performance of adding to the tail of a list; it's done with some wrapping, like a structure that keeps a pointer to the tail. Usually that is only locally used; it doesn't "travel" as part of the representation of the list. It is not an encapsulation device, but only a process device. Of course there is also the common pattern of building up a list in reverse followed by a destructive nreverse. And the meta-approach of designing things to avoid doing work at the tail end of the list.

I just remembered the existence of some C code that has nothing to do with any Lisp implementation internals, which pushes and nreverses: http://www.kylheku.com/cgit/c-snippets/tree/autotab.c#n228

A double-ended queue (deque) can be formed in Lisp by using a pair of lists. So both ends of the queue are list heads, from which we cdr into the interior. I developed such a thing which is hosted here:

http://www.kylheku.com/cgit/lisp-snippets/tree/deque.lisp

With this deque, we simply use the push macro to add items to either end of the queue. pop-deque will remove an item from either end. Underflows are handled by rebalancing the dequeue: shuffling items from one list to the other. The cost of that is amortized. (BTW I see that pop-deque has a multiple-evaluation-of-arguments problem; it really should be written using get-setf-expansion.)

Re:At 22 years old, Postgres might just be the most advanced... by neilc on Wednesday December 05, 2018 @03:23PM (#18612128)
> In code that truly embraces "Lispy" lists, you cannot switch to an encapsulated list representation without making substantial changes to the code.

I think changing the list representation made sense in part because the rest of the codebase didn't use lists in a deeply Lispy way, for the most part.

Re:At 22 years old, Postgres might just be the most advanced... by agumonkey on Wednesday December 05, 2018 @02:35PM (#18611679)
You should host teachings in college and schools.
Re:At 22 years old, Postgres might just be the most advanced... by polskibus on Wednesday December 05, 2018 @01:59PM (#18611300)
Oracle like many other databases has clustered indexes. PostgreSQL does not and it can have big performance implications.
Re:At 22 years old, Postgres might just be the most advanced... by SigmundA on Wednesday December 05, 2018 @06:01PM (#18613634)
Yes they really should look at adding index organized tables, aka real clustered indexes.

Better space usage and performance for that single index since the table is the index, slightly worse performance for non clustered indexes due to a double index traversal.

Re:At 22 years old, Postgres might just be the most advanced... by mmaurizi on Wednesday December 05, 2018 @02:07PM (#18611378)
Re:At 22 years old, Postgres might just be the most advanced... by polskibus on Wednesday December 05, 2018 @02:13PM (#18611435)
That's not how a real clustered primary key works, because "the changes are not clustered.".
Re:At 22 years old, Postgres might just be the most advanced... by asah on Wednesday December 05, 2018 @02:46PM (#18611759)
can confirm.

That said, one can often capture much of the performance benefit with Postgres indexes - basically, instead of trying to tightly-pack the base tables, copy the data into indexes which are tightly packed exactly as you need. Put another way, Postgres indexes are synchronously updated materialized views - and yes, the Postgres planner/optimizer will automatically answer queries from an index if it's faster and all the columns are in there.

I esp recommend reading about function and expression indexes, as well as the (new) covering indexes.

http://blog.scoutapp.com/articles/2016/05/31/3-postgresql-in... https://www.endpoint.com/blog/2013/06/10/postgresql-function... https://paquier.xyz/postgresql-2/postgres-11-covering-indexe...

Re:At 22 years old, Postgres might just be the most advanced... by polskibus on Wednesday December 05, 2018 @03:03PM (#18611895)
Surely the writes will be much slower if you have to copy the data to the index
Re:At 22 years old, Postgres might just be the most advanced... by Tostino on Wednesday December 05, 2018 @10:15PM (#18615054)
What do you think a (non clustered) index is? Of course it slows down writes.
Re:At 22 years old, Postgres might just be the most advanced... by polskibus on Thursday December 06, 2018 @01:25AM (#18615865)
It was a reply to proposed workaround, to show that it still has significant drawbacks
Re:At 22 years old, Postgres might just be the most advanced... by sdegutis on Wednesday December 05, 2018 @02:27PM (#18611603)
Legacy code + Enterprise = a life so long it feels like butter spread a little too thin over toast, as Bilbo Baggins put it.
Re:At 22 years old, Postgres might just be the most advanced... by diminoten on Wednesday December 05, 2018 @02:00PM (#18611318)
Have you tried to scale horizontally with Postgres?
Re:At 22 years old, Postgres might just be the most advanced... by outworlder on Wednesday December 05, 2018 @02:07PM (#18611382)
Have you tried to scale horizontally with Oracle?
Re:At 22 years old, Postgres might just be the most advanced... by DiabloD3 on Wednesday December 05, 2018 @02:17PM (#18611478)
Oracle scales horizontally perfectly... even up to hundreds of cores, it runs just as fast.
Re:At 22 years old, Postgres might just be the most advanced... by diminoten on Wednesday December 05, 2018 @02:18PM (#18611481)
Yes, and I cried when I saw the bill.

FWIW I much prefer Postgres to Oracle, but not because of the technology as much as the price.

Re:At 22 years old, Postgres might just be the most advanced... by spapas82 on Wednesday December 05, 2018 @02:02PM (#18611343)
Because "nobody was fired for choosing oracle" https://www.google.com/search?hl=en&q=hackernews%20nobody%20...
Re:At 22 years old, Postgres might just be the most advanced... by SilasX on Wednesday December 05, 2018 @04:00PM (#18612483)
I don't think anyone "prefers" Oracle; it just persists on some combination of politicking, inertia, vendor lock-in, and contracts that assure regulatory compliance.
Re:At 22 years old, Postgres might just be the most advanced... by paulie_a on Wednesday December 05, 2018 @02:14PM (#18611440)
I'm confused why anyone prefer Oracle at all. You can basically swing a bat at their codebase and default creds come raining down. Everything they touch has a steroid infused YOLO.
Re:At 22 years old, Postgres might just be the most advanced... by hildaman on Wednesday December 05, 2018 @01:58PM (#18611290)
I'll tell you why - try to update one column in 100GB worth of row data.

Postgress makes a copy of _every_ row and you need 100GB of extra space on the hard-drive until you commit the transaction. Now extrapolate to a 1TB table that needs updating.

Oracle has a way of doing this w/o copying the entire row.

Re:At 22 years old, Postgres might just be the most advanced... by snuxoll on Wednesday December 05, 2018 @02:08PM (#18611386)
> Postgress makes a copy of _every_ row and you need 100GB of extra space on the hard-drive until you commit the transaction.

This only happens if the column is indexed, heap-only-tuples will allow in-place updates otherwise. This doesn't dismiss it as a potential problem entirely, but depending on your needs you may never run into this.

Re:At 22 years old, Postgres might just be the most advanced... by djd20 on Wednesday December 05, 2018 @02:17PM (#18611467)
I would argue thats an issue with your architecture at that point - you may want to use table partitioning at sizes that big, or have some other mechanism in place to be able to lock access while updating such large data sets in one go.
Re:At 22 years old, Postgres might just be the most advanced... by snuxoll on Wednesday December 05, 2018 @02:22PM (#18611529)
I would generally agree, though there are unfortunately limitations imposed on you the moment you start using partitioning with PostgreSQL (foreign keys remain to be a big one).
Re:At 22 years old, Postgres might just be the most advanced... by Tostino on Wednesday December 05, 2018 @10:17PM (#18615063)
Not as of PG 11
Re:At 22 years old, Postgres might just be the most advanced... by snuxoll on Thursday December 06, 2018 @02:15AM (#18616054)
You still can’t make FK references TO partitioned tables, unfortunately.
Re:At 22 years old, Postgres might just be the most advanced... by nly on Wednesday December 05, 2018 @02:51PM (#18611800)
So what's the workaround? Drop the index, update, then re-establish the index?
Re:At 22 years old, Postgres might just be the most advanced... by gopalv on Wednesday December 05, 2018 @02:21PM (#18611520)
> Postgress makes a copy of _every_ row

That's what the zHeap storage engine for Postgres fixes - in-place updates for fixed width data.

https://github.com/EnterpriseDB/zheap

Re:At 22 years old, Postgres might just be the most advanced... by hildaman on Wednesday December 05, 2018 @05:35PM (#18613385)
"for eventual integration into PostgreSQL"..
Re:At 22 years old, Postgres might just be the most advanced... by Tostino on Wednesday December 05, 2018 @10:19PM (#18615070)
And is being actively developed through the mailing list. Feel free to follow the progress. It's great to watch it happen in real time.
Re:At 22 years old, Postgres might just be the most advanced... by marcosdumay on Wednesday December 05, 2018 @03:15PM (#18612037)
> Oracle has a way of doing this w/o copying the entire row.

And I have seen Oracle 12c servers completely lock because of that way.