Shared posts

25 Sep 18:02

Felipe Sabino liked a review

23 Sep 11:01

Natalie wants to read 'Burning Down 'The Shack': How The 'Christian' Bestseller Is Deceiving Millions'

23 Sep 04:00

Datacenter Scale

Asimov's Cosmic AC was created by linking all datacenters through hyperspace, which explains a lot. It didn't reverse entropy--it just discarded the universe when it reached end-of-life and ordered a new one.
22 Sep 12:06

Edson Macedo liked a review

From Paradise to the Promised Land by T. Desmond Alexander
"Alexander provides an excellent synthetic overview of the Pentateuch. Readers will be pleasantly surprised to find this book on the Pentateuch an easy read. The book does an admirable job at showing the theological and thematic developments and the connections both within the Pentateuch, and broader canon. The book is recommended for undergraduate students, and deals only lightly with historical-critical issues. While the basic introduction to Pentateuchal criticism is helpful, the strength of the book is found in the subsequent sections. Individuals who wish to focus on themes and survey, may safely jump to Part 2. Although the work is no substitute for more micro-focused, exegetical treatment, I found the macro lens to lend helpful perspective as I read the Pentateuch. From Paradise to Promise land is designed for beginners, but will allow almost anyone to walk away with an enhanced understanding of the Pentateuch's story."
22 Sep 12:10

Edson Macedo liked a review

From Paradise to the Promised Land by T. Desmond Alexander
"You can read my full review here: spoiledmilks dot wordpress dot com/2015/02/28/review-from-paradise-to-the-promised-land/

Alexander says, "The present volumes seeks to (1) guide the reader through the maze of modern approaches to the Pentateuch, and (2) focus on the main themes of the Pentateuch, viewed as a unified literary work, by drawing on the best insights of recent research into Hebrew narrative techniques" (p xiii).

Part 1; Pentateuchal Criticism
Being an introduction, one should expect some discussion on Pentateuchal studies. Alexander spends six chapters going through the history of these studies, introducing the reader to source-, form-, Traditio-historical-, and literary-criticism, and bringing the reader's main focus to the Documentary Hypothesis.

While one should be aware (and probably expects) that these chapters are not an easy read, yet I actually found these first six chapters to be quite interesting, much more than I thought they would be. On the one hand, these chapters are quite detailed, showing the intricacies of PC and just what one would expect to find when sifting through scholarly work over the Pentateuch. Many (but not all!) large, scholarly works will be brimming with information on the legitimacy of the DH, and one should be aware of what they will find when they read those works.

Here Alexander does not side with the DH espousers, but shows criticisms against it and makes a good case (albiet a small case) against the DH.

Part 2; The Main Themes of the Pentateuch

This is where the book will become 'alive' for many readers. For though as interesting as reading about various criticisms and critiques of the Pentateuch may be, reading the very words Moses wrote is far more interesting (as it should be!). Here Alexander looks at a broad range of themes starting in Genesis and "ending" in Deuteronomy (they don't really 'end in Deuteronomy. The biblical authors pick up the themes and carry them on throughout the Old and New Testaments.

The Chocolate Milk

In looking at Pentateuchal themes, rather than being a collection of different sources, Alexander shows how the Pentateuch is a unified work and works that into the main themes of the Pentateuch. The final portion of each thematic chapter in Part 2 was the New Testament Connections section, which I always enjoyed reading. Alexander summarizes how a particular theme ('Be Holy') is seen in the NT and is fulfilled in some way in Jesus. What defiles a person is not what they eat, but what is inside of them (Mk 7.20-23).

The Spoiled Milk

One disappointment I had was that more of the Pentateuch wasn't covered. As important as the themes are (I never really thought much about a lot of the themes mentioned here and their impact on the Five Books of Moses), I think the name of the book may be a bit misleading. Perhaps I'm used to books like deSilva's An Introduction to the New Testament which looks at themes of the New Testament and summarizes each letter. While one book cannot do everything, I'm left wondering about much of what happens in the Genesis story after Abraham (though Alexander spends six chapters on Genesis, and does talk about Isaac, Jacob, and Joseph). Not to mention special laws in Leviticus (three chapters), or most of Deuteronomy (only two chapters are spent discussing this huge book).

The only criticism I have about the Old Testament Summary section was that it really wasn't a summary of how the theme is seen in the Old Testament, but more how it is seen either in that individual book ('Murmurings' in Numbers) or in the Pentateuch. Again, perhaps misnamed, but it seems like "Pentateuchal Summary" would be more apt.

[Special thanks to Trinity at Baker Publishing for allowing me to review this book! I was not obligated to provide a positive review in exchange for this book.]"
22 Sep 06:13

Felipe is on page 97 of 101 of Professor Não É Educador

Professor Não É Educador by Armindo Moreira Felipe is on page 97 of 101 of <a href="/book/show/26085680-professor-n-o-educador">Professor Não É Educador</a>.
21 Sep 23:59

Leonardo wants to read 'Normative Aesthetics: Sundry Writings and Occasional Lectures'

21 Sep 23:30

Leonardo is currently reading 'Além do Planeta Silencioso'

Além do Planeta Silencioso by C.S. Lewis Leonardo is currently reading Além do Planeta Silencioso by C.S. Lewis
21 Sep 17:49

Marcel wants to read 'O Fator Melquisedeque: O testemunho de Deus nas culturas por todo o mundo'

21 Sep 01:34

Felipe wants to read 'My Father Before Me: How Fathers and Sons Influence Each Other Throughout Their Lives'

21 Sep 00:52

Craig Ringer: BDR is coming to PostgreSQL 9.6

I’m pleased to say that Postgres-BDR is on its way to PostgreSQL 9.6, and even better, it works without a patched PostgreSQL.

BDR has always been an extension, but on 9.4 it required a heavily patched PostgreSQL, one that isn’t fully on-disk-format compatible with stock community PostgreSQL 9.4. The goal all along has been to allow it to run as an extension on an unmodified PostgreSQL … and now we’re there.

The years of effort we at 2ndQuadrant have put into getting the series of patches from BDR into PostgreSQL core have paid off. As of PostgreSQL 9.6, the only major patch that Postgres-BDR on 9.4 has that PostgreSQL core doesn’t, is the sequence access method patch that powers global sequences.

This means that Postgres-BDR on 9.6 will not support global sequences, at least not the same way they exist in 9.4. The 9.6 version will incorporate a different approach to handling sequences on distributed systems, and in the process address some issues that arose when using global sequences in production.

Since Postgres-BDR on 9.6 is now passing regression tests, I expect to have an alpha release out not long after the release of PostgreSQL 9.6 itself. Keep an eye out!

There’s also a pglogical 1.2.0 update coming to coincide with the release of PostgreSQL 9.6.

At the same time, Petr has submitted another revision of logical replication for core PostgreSQL to the 10.0 development series.

Along with updating Postgres-BDR in concurrence with 9.6, there is work in progress to enhance Postgres-BDR’s HA capabilities. I’ll have more to say on that in an upcoming post.

We’ve been busy here at 2ndQuadrant.

21 Sep 04:13

Felipe wants to read 'Imitating God in Christ: Recapturing a Biblical Pattern'

20 Sep 08:00

David Rader: Improve PostgreSQL on Windows performance by 100%

L

Crap OS!

It sounds like click-bait, or one of those late night TV promotions – “Improve your database performance by 100% – by changing just this one setting!” But in this case, it’s true – you can drastically improve PostgreSQL on Windows performance by changing one configuration setting – and we made this the default in our Postgres by BigSQL distribution for 9.2 thru 9.6.

tl;dr – if you have high query load, change “update_process_title” to ‘off’ on Windows, and get 100% more throughput.

Improve postgresql performance by turning off update_process_title

Performance Improvement by turning off update_process_title

Most Postgres DBA’s already know that they need to tune settings for shared buffers, WAL segments, checkpoints, etc, to get the best performance from their database. If you are running PostgreSQL on Windows, there’s another setting that you need to look at, specifically “update_process_title”. Changing this setting from “on” to “off” can improve throughput on a heavy query load by close to 100%

We ran a series of benchmark tests in our performance lab and you can see the dramatic improvement in the graphs displayed. We tested PostgreSQL 9.5 on a 16-core Windows server with fast SSD drives using a standard pgbench run in both read-only and read-write modes. Scaling from 4 to 40 clients shows a plateau in throughput (measured by TPS) after 8 clients when the setting is set to “on”. Changing the update_process_title setting to “off” allows PostgreSQL to continue to scale throughput, showing increasing TPS up to 40 clients. The throughput at 32 read-only clients increases from 20K TPS to 58K TPS (180% higher) and at 40 clients continues to climb to 76K TPS (270% higher).

Improvement in read-write transactions turning off update_process_title

Improvement in read-write transactions turning off update_process_title

This performance gain is seen for both read-only and read-write workloads. With 32 clients, the write throughput increases from 2,700 TPS to 7,700 TPS (180% higher) and at 40 clients continues to climb to 8,200 (200% higher).

The update_process_title setting controls whether or not Postgres will update the process description that you see when querying the system list of running commands based on the current SQL statement being processed. On Linux this is done using ps, on Windows it requires the ProcessExplorer tool. Updating the process description becomes a bottleneck on Windows, and limits the throughput even on a high-end server. Not many Windows admins actually use this information on a regular basis, so unless you are actively debugging a slow or long running process using this process information, you should leave this turned off.

Takayuki Tsunakawa originally tracked down this bottleneck and created a patch for PostgreSQL 9.6 that has changed the default to be ‘off’ on Windows. We have made the same setting change in BigSQL distributions of version 9.2 thru 9.5 as well as 9.6. So even if you’re not ready to move to the new 9.6 version, when you install Postgres by BigSQL on Windows you are getting the best performance out-of-the-box.

 

20 Sep 11:11

Natalie added 'What Some Of You Were'

What Some Of You Were by Christopher Keane Natalie gave 4 stars to What Some Of You Were (Paperback) by Christopher Keane
bookshelves: good-theology
A compilation of stories that have originated with Liberty Christian Ministries. They specialise in dealing with Christians (and others) struggling with same-sex attraction.

The homosexuality issue seems to have become seriously controversial in Christian circles and many avoid discussing it altogether. The church of England has sadly compromised its biblical stance as have many other denominations. The result is that some Christians are confused about where they should stand and others think that if they pretend the issue doesn't exist it will go away. There is also a climate of fear about expressing biblical views on the issue due to the general direction of the law-makers. But this sin with all its associated damage will not just suddenly vanish anymore than any other sin. We must not give in to groups like Stonewall who want to abolish Christian views on the subject altogether.

There is a difference between saying homosexuality is unacceptable to God and being homophobic. When one says the Bible stands against the performance of homosexual acts, that is not homophobic. It is not vilification to say that God rejects some human sexual behaviour. And it is no more homophobic than rejecting Christ and his messengers is Christophobic. Paul condemns a range of human behaviours (1 Corinthians 6 vs 9-11.) Homosexuality is on the list, alongside drunkenness and greed. Paul does not suggest one is better or worse than the other-these kinds of actions are incompatible with being the people of God.

This book will help Christians to better understand same-sex attraction and how to interact with those who are struggling and desire to change. There is a big difference between someone who says that they are gay, Christian and proud and someone who acknowledges their difficulty and desires to deal with it biblically. The latter are the people that really need our support and help not our condemnation and judgement. All of us are prone to weakness and temptation, why is homosexuality suddenly the big taboo?

Let's make it clear. Heterosexual adultery is no more and no less of a sin than homosexuality. Christians do not argue for heterosexuality but for obedience to God. That has implications for all of us, no matter what our gender orientation.

The book has testimonies from those who are attempting to live biblically despite their same-sex attraction either through praying and hoping for change in their orientation or through life-long celibacy. There are success stories for both approaches. It also documents a parental perspective--when a child comes out as gay. Also when a husband or wife tells their spouse they are struggling.

I particularly liked the appendix chapters which deal with

1. How we went gay (as a nation)
2. Is homosexuality biologically determined?
3. On homosexuality and change
4. Homosexuality in the New Testament

This is a good book that will not only encourage Christians to give proper support to those struggling but will clarify where Christians should stand on the issue of homosexuality.
19 Sep 04:00

Fashion Police and Grammar Police

* Mad about jorts
19 Sep 02:02

Felipe Sabino liked a review

The Fundamentals by R.A. Torrey
"In the early part of the twentieth century a controversy in the church erupted between the modernists and the fundamentalists. The fundamentalists got their name from the fact that they published an enormous number of booklets defending "the fundamentals," by which they mean the infallibility of the Bible, the deity of Christ, etc. Those booklets were published in four volumes, and I have to say that I am quite proud of my fundamentalist fathers. They acquitted themselves well, and with great learning. They were (to my view) a tad too accommodating with some things (e.g. age of the earth), but for the most part they held the line wonderfully.

The last essay in Volume 1 has this marvelous line, addressing the modernists, who haven't changed a bit in the last century.

"A striking characteristic of these people is a persistent ignoring of what is written on the other side."

The date marks my completion of the first volume. I will note when I finish the other three volumes in the body of the text here. Finished the second volume in September 2016."
16 Sep 10:41

Eduardo Maçan shared Raio Privatizador's photo.

by Eduardo Maçan

Eduardo Maçan shared Raio Privatizador's photo.

E sumam com essa porcaria de computador, internet e smartfones também!

¯(ツ)

EDIT: E os teares! Destruam os teares!
EDIT2: Pela volta dos ascensoristas!
EDIT3: E dos digitadores também!
EDIT4: Não... dos digitadores não... eles trarão computadores com eles.

14 Sep 17:17

De volta ao papel e às canetas-tinteiro

by Rodrigo Gurgel

Tenho a mania terrível de ir na contramão do meu tempo. Na verdade, não é terrível, mas salutar. Há formas de pensar, valores, livros, comportamentos, hábitos que, hoje, começam a ser esquecidos, mas não perderam sua importância. Podem inclusive estar completamente esquecidos por alguns, mas continuam emitindo sinais inquestionáveis de que, se recuperados, têm o poder de melhorar nossa vida.

Sou um aficionado da tecnologia. Um novo software — que esteja ligado, de alguma forma, à escrita ou à leitura — sempre me atrai. E, graças à tecnologia, meu trabalho se tornou, nos últimos anos, menos cansativo, pois pude suprimir etapas que me faziam perder tempo — como copiar, para um arquivo Word, as anotações com que sempre preencho os livros que leio. Leitores de e-books tornaram-se não só úteis, mas indispensáveis.

Entretanto, a onipresença do teclado me incomodava. O distanciamento de uma forma de escrita que me obrigasse a desenhar as palavras pareceu-me, a partir de certo momento, uma perda estética — ainda mais para mim, que sempre apreciei as canetas-tinteiro, a textura dos diferentes papéis, o odor e as cores das tintas. Havia uma perda sensorial que me perturbava.

O que era uma impressão vaga, desconforto impreciso, ganhou corpo quando li o estudo de Pam A. Mueller e Daniel M. Oppenheimer a respeito de como tomar notas em laptops resulta num processamento mais superficial das ideias. No primeiro momento, desconfiei do estudo — não seria mais uma conclusão apocalíptica? Depois, refletindo, comparando as conclusões dos pesquisadores ao que tantos escritores afirmam, comecei a questionar meu julgamento: não, concluí, voltar a escrever com canetas-tinteiro não se tratava apenas de nostalgia, ainda que esse sentimento estivesse presente.

papel e caneta-tinteiro

Estou convencido de que as canetas-tinteiro e o papel trouxeram-me uma conexão parcialmente perdida entre meus pensamentos e a linguagem, a elaboração do texto.

A única forma de descobrir os efeitos da escrita à mão seria voltar aos velhos instrumentos — e quando decidi fazê-lo, percebi que, sim, eu desenvolvia as ideias com mais facilidade, com maior rapidez. O texto brotava com uma celeridade que eu havia esquecido.

Pode parecer pedante, mas reutilizar a caneta-tinteiro, ver o desenho das letras no papel, alimenta uma espécie de prazer. Tudo me parece mais real, mais vivo. Estou conectado ao meu próprio eu de uma forma mais clara, mais intensa. A própria cadência da mão sobre o papel, desenhando os sinais que me acompanham desde a infância, quando minha mãe ensinou-me a escrever em pedaços de papel polvilhados de farinha, tudo me torna mais produtivo, mais próximo da minha índole. A escrita deixou ser um ofício, ofício de que me orgulho, para ser também uma forma de aconchego.

Estou convencido de que as canetas e o papel trouxeram-me uma conexão parcialmente perdida entre meus pensamentos e a linguagem, a elaboração do texto. Escrever à mão talvez produza outros tipos de sinapses. Ou talvez eu esteja apenas sonhando. Mas meus escritos, com certeza, agora refletem melhor minha personalidade.

The post De volta ao papel e às canetas-tinteiro appeared first on Rodrigo Gurgel.

09 Sep 04:00

Wrong

Hang on, I just remembered another thing I'm right about. See...
08 Sep 04:57

[$] An asynchronous Internet in GNOME

by n8willis

At GUADEC 2016 in Karlsruhe, Germany, Jonathan Blandford challenged the GNOME project to rethink how its desktop software uses network access. The GNOME desktop assumes Internet connectivity is always available, which has the side effect of making the software stack considerably less useful and, indeed, usable to people who live in those places regarded as the developing world.

06 Sep 23:00

Julia Reda, MEP: "Proprietary Software threatens Democracy"

Julia Reda, MEP: "Proprietary Software threatens Democracy"

Julia Reda ended the QtCon, a conference for the Free Software community, with a closing keynote on, among other things, Free Software in the European Public Sector.

Ms Reda, a member of the EU Parliament for the Pirate Party, explained how proprietary software, software that forbids users from studying and modifying it, has often left regulators in the dark, becoming a liability for and often a threat to the well-being and health of citizens.

An example of this, she said, is the recent Dieselgate scandal, in which auto-mobile manufacturers installed software that cheated instruments that measured fumes in test environments, only to spew illegal amounts of toxic exhaust into the atmosphere the moment they went on the road.

Ms Reda also explained how medical devices running proprietary software posed a health hazard for patients. She gave the example of a woman with a pacemaker who collapsed while climbing some stairs due to a bug in her device. Doctors and technicians had no way of diagnosing and correcting the problem as they did not have access to the code.

Also worrying is the threat software with restrictive licenses pose to democracy itself. The trend of substituting traditional voting ballots with voting machines is especially worrying, because, as these machines are not considered a threat to national security, their software also goes unaudited and is, in fact, unauditable in most cases.

And, although voting machines are built and programmed by private companies, they are commissioned by public entities and paid for with public money, money taken from citizens' taxes. However, there are no universal EU regulations that force companies, or, indeed, public organisations, to make the source code available to the citizens that have paid for it, said Ms Reda.

Furthermore, she noted that, despite the fact Free Software technologies (web servers, CMSs, email servers, and so on) are used extensively throughout the public administration, the public sector assumes very little responsibility in the way of giving back to the community via patches or even bug reports.

Ms Reda said that the solution to this very dismal state of affairs is a multi-pronged one. She commended the Free Software Foundation Europe for its work in advocating for all software commissioned by public entities and paid with public money, be made available under free/libre licenses for everyone. She also noted that to get governments on the side of Free Software it is essential to make them see its merits.

Only like this, she said, would it be possible to make legislators regulate coherently in favour of free/libre technologies.

Support FSFE, join the Fellowship
Make a one time donation

02 Sep 15:27

Douglas added '"But God...": The Two Words at the Heart of the Gospel'

"But God..." by Casey Lute Douglas gave 4 stars to "But God...": The Two Words at the Heart of the Gospel (Paperback) by Casey Lute
This is a very encouraging little book, pointing to two words that function as the hinge of all gospel living. There is a problem, a dilemma, a crisis, a trouble, and God’s people are up against it. This happens time and again in the Scriptures. And the next two words are but God . . .

Casey Lute walks through the Scriptures, pointing to nine key instances of this. He starts with Noah. “But God remembered Noah and all the beasts and all the livestock that were with him in the ark. And God made a wind blow over the earth, and the waters subsided” (Gen. 8:1, ESV).

The God of the Bible is the God who saves, and He saves us in the middle of the story. The problem is sketched out and made clear, and then, when all hope is lost, we hear the words but God. God loves cliffhangers.

But God remembered Noah. But God delivered Israel at the Red Sea. But God raised Jesus from the dead. This book is a quick read, but quite meaty for all that.
02 Sep 15:50

Frederico wants to read 'A Fênix Islamista: O Estado Islâmico e a Reconfiguração do Oriente Médio'

02 Sep 15:51

Frederico wants to read 'A Batalha do Avaí - A beleza da barbárie: a Guerra do Paraguai pintada por Pedro Américo'

02 Sep 16:04

Felipe wants to read 'On the Government of God'

On the Government of God by Salvian Felipe wants to read On the Government of God by Salvian
02 Sep 04:26

Gripen Image Of The Month

by Saab AB
.:

czech gripen 6.jpg
Gripen's high operational availability, rapid turnaround and minimal support requirements delivers more time in the air.

 Photo: Jörgen Nilsson (jn_photo.se)​

Published: 9/1/2016 6:23 AM
02 Sep 11:34

Felipe Sabino liked a review

02 Sep 11:34

Felipe Sabino liked a review

01 Sep 09:00

Dan Robinson: When To Avoid JSONB In A PostgreSQL Schema

PostgreSQL introduced the JSONB type in 9.4 with considerable celebration. (Well, about as much as you can expect for a new data type in an RDBMS.) It’s a wonderful feature: a format that lets you store blobs in the lingua franca of modern web services, without requiring re-parsing whenever you want to access a field, and in a way that enables indexing for complicated predicates like containment of other JSON blobs. It meaningfully extends PostgreSQL and makes it a viable choice for a lot of document store workflows. And it fits nicely in a startup engineering context: just add a properties column to the end of your table for all the other attributes you might want to store down the road, and your schema is now officially Future Proof TM.

We lean on JSONB heavily at Heap, and it’s a natural fit, as we have APIs that allow customers to attach arbitrary properties to events we collect. Recently, I’ve gotten a few questions about the benefits and drawbacks of using JSONB to store the entirety of a table – why have anything but an id and a data blob?

The idea of not having to explicitly manage a schema appeals to a lot of people, so it shouldn’t be surprising to see JSONB used this way. But there are considerable performance costs to doing so, some of which aren’t immediately obvious. There is great material for deciding which of JSON, JSONB, or hstore is right for your project, but the correct choice is often “none of the above.” [1] Here are a few reasons why.

Hidden Cost #1: Slow Queries Due To Lack Of Statistics

For traditional data types, PostgreSQL stores statistics about the distribution of values in each column of each table, such as:

  • the number of distinct values seen
  • the most common values
  • the fraction of entries that are NULL
  • for ordered types, a histogram sketch of the distribution of values in the column

For a given query, the query planner uses these statistics to estimate which execution plan will be the fastest. For example, let’s make a table with 1 million “measurements” of three values, each chosen at uniform random from {0, 1}. Each measurement was taken by one of 10,000 scientists, and each scientist comes from one of three labs:

Let’s say we want to get the tick marks in which all three values were 0 — which should be about 1/8th of them — and see how many times each lab was represented amongst the corresponding scientists. Our query will look something like this:

And our query plan will look something like this: https://explain.depesz.com/s/H4oY

This is what we’d hope to see: the planner knows from our table statistics that about 1/8th of the rows in measurements will have value_1, value_2, and value_3 equal to 0, so about 125,000 of them will need to be joined with a scientist’s lab, and the database does so via a hash join. That is, load the contents of scientist_labs into a hash table keyed on scientist_id, scan through the matching rows from measurements, and look each one up in the hash table by its scientist_id value. The execution is fast — about 300 ms on my machine.

Let’s say we instead store our measurements as JSONB blobs, like this:

The analogous read query would look like this:

The performance is dramatically worse — a whopping 584 seconds on my laptop, about 2000x slower: https://explain.depesz.com/s/zJiT

The underlying reason is that PostgreSQL doesn’t know how to keep statistics on the values of fields within JSONB columns. It has no way of knowing, for example, that record ->> 'value_2' = 0 will be true about 50% of the time, so it relies on a hardcoded estimate of 0.1%. So, it estimates that 0.1% of 0.1% of 0.1% of the measurements table will be relevant (which it rounds up to ~1 row). As a result, it chooses a nested loop join: for each row in measurements that passes our filter, look up the corresponding lab_name in scientist_labs via the primary key of the latter table. But since there are ~125,000 such measurements, instead of ~1, this turns out to take an eternity. [2]

As always, accurate statistics are a critical ingredient to good database performance. In their absence, the planner can’t determine which join algorithms, join orders, or scan types will make your query fast. The result is that innocent queries will blow up on you. This is one of the hidden costs of JSONB: your data doesn’t have statistics, so the query planner is flying blind.

This is not an academic consideration. This caused production issues for us, and the only way to get around them was to disable nested loops entirely as a join option, with a global setting of enable_nestloop = off. Ordinarily, you should never do something like that.

This probably won’t bite you in a key-value / document-store workload, but it’s easy to run into this if you’re using JSONB along with analytical queries.

Hidden Cost #2: Larger Table Footprint

Under the hood, PostgreSQL’s JSON datatype stores your blobs as strings that it happens to know are valid JSON. The JSONB encoding has a bit more overhead, with the upside that you don’t need to parse the JSON to retrieve a particular field. In both cases, at the very least, the database stores each key and value in every row. PostgreSQL doesn’t do anything clever to deduplicate commonly occurring keys.

Using the above measurements table again, the initial non-JSONB version of our table takes up 79 mb of disk space, whereas the JSONB variant takes 164 mb — more than twice as much. That is, the majority of our table contents are the the strings value_1, value_2, value_3, and scientist_id, repeated over and over again. So, in this case, you would need to pay for twice as much disk, not to mention follow-on effects that make all sorts of operations slower or more expensive. The original schema will cache much better, or might fit entirely in memory. The smaller size means it will also require half as much i/o for large reads or maintenance operations.

For a less contrived anecdote, we found a disk space savings of about 30% by pulling 45 commonly used fields out of JSONB and into first-class columns. On a petabyte-scale dataset, that turns out to be a pretty big win.

As a rule of thumb, each column costs about 1 bit of overhead for each row in your table, regardless of whether the column’s value is null.[3] So, for example, if an optional field is going to have a ten-character key in your JSONB blobs, and thus cost at least 80 bits to store the key in each row in which it’s present, it will save space to give it a first-class column if it’s present in at least 1/80th of your rows.

For datasets with many optional values, it is often impractical or impossible to include each one as a table column. In cases like these, JSONB can be a great fit, both for simplicity and performance. But, for values that occur in most of your rows, it’s still a good idea to keep them separate.

In practice, there is often additional context to inform how you organize your data, such as the engineering effort required to manage explicit schemas or the type safety and SQL readability benefits from doing so. But there is often an important performance penalty as well for unnecessarily JSONB-ing your data.

Know another innocuous change with big performance implications? Ping me @danlovesproofs.

We’re constantly evaluating alternative schemas and indexing strategies for serving ad hoc queries across hundreds of billions of events. Interested in working with us? Shoot us a note at jobs@heapanalytics.com.

[1] I recommend this post, for starters: https://www.citusdata.com/blog/2016/07/14/choosing-nosql-hstore-json-jsonb/
[2] As an aside, explain.depesz is a wonderful tool for finding problems like these in your queries. You can see in this example that the planner underestimated how many rows would be returned by this subquery by a factor of 124,616.
[3] This isn’t quite correct. PostgreSQL allocates one byte per row for the first 8 columns, and then 8 bytes / 64 rows at a time after that. So, for example, your first 8 rows are free, and the 9th costs 8 bytes per row in your table, and then the 10th through 72nd are free, and so forth. (H/t Michael Malis for the investigation into this.)
30 Aug 16:20

Felipe commented on Leandro's review of Panaceia

New comment on Leandro's review of Panaceia
by Rodrigo Constantino

Por favor, leia os romances do Mainardi , em especial:

A queda
Malthus
Arquipélago
Contra o Brasil
Polígono das Secas