« first day (3979 days earlier)      last day (57 days later) » 

7:16 AM
A chairde - Morning all! Last man out, first man in! :-)
 
7:41 AM
1
A: How to fetch a row that contains the set of last non-NULL values for each column in postgres?

QuassnoiThe solution proposed by J.D. will work, but it will have to sort the whole table three times and do quite an expensive DISTINCT. As was alluded to in the comments, efficiently solving this task would require a window function similar to FIRST_VALUE with a filter, which, unfortunately, PostgreSQL...

 
7:55 AM
@ypercubeᵀᴹ I put in your answer as a community wiki - removed my dog's (ahem... err... ahh) "dinner" of an answer. I did a performance analysis - you're no. 2 after Quassnoi, so not too bad? I answered the "decimal point" - I did put a lot of work in - went down many rabbit holes! :-) Got a correct answer tick for my troubles! Any input would be appreciated.
I have a question up on Overflow for a more generic regex - there's a Polish lad there who's pretty hot on regexes! Fingers crossed!
 
You know my answer is the same as Quassnoi's option 1, right?
Most important, how big was the table that you did performance analysis?
I would expect Quassnoi's option 2 to be the fastest in some cases.
(eg when the table has very few non-null values in one (or more) columns and they are all in the "start" of the table (low version numbers) while the rest being all nulls.)
@Vérace-getVACCINATEDNOW I'll check it.
 
@ypercubeᵀᴹ I did mention that the usual caveats apply! It was consistent though - but maybe it was the order in which they were performed? I can remove it if appropriate?
@ypercubeᵀᴹ - put yours at the bottom - results reversed! F*&^ that - I'll delete!
 
8:20 AM
Morning
 
8:31 AM
Morning
 
'Morning all.
 
 
1 hour later…
9:36 AM
@Vérace-getVACCINATEDNOW please add in your answer: dbfiddle.uk/…
and check what happens when the indexes match nicely the query:
> Planning Time: 0.530 ms
Execution Time: 0.090 ms
(with 20k rows ^^)
 
10:14 AM
I did some more tweaks in the fiddle and edited it in your wiki answer
 
10:55 AM
If someone interested, Udemy curses are at 90% off
 
nice one ;)
 
11:08 AM
@McNets .. or use Mongo and people will curse you for free. :-)
2
 
11:44 AM
@MichaelGreen sorry courses!! ha ha
The Curse of the Dark Heap
3
 
 
1 hour later…
12:48 PM
Dork Heap?
 
 
2 hours later…
2:24 PM
Snark Heap
 
 
3 hours later…
5:07 PM
epic comment of the day in Workplace
Are you really complaining about being paid for not working? — Unfair-Ban 6 hours ago
 
 
3 hours later…
8:12 PM
0
Q: Postgres v10 is not using the index in a subquery

user590000I have a subquery that will return 3 records, to later add the result of some calculations (using some functions). When I am running the full query, Postgres is calculating a high number of expected rows and decides not to use the index. but when I use just the subquery, the index is used. Plese ...

this question originally had screenshots of queries and plans, which wasn't nice (I asked the OP to add them as text), but still was useful to identify the problem.
The OP deleted the screenshots instead. The question will probably be more useful with screenshots than without them. Should I roll back the OP's edit and put the screenshots back?
 
 
1 hour later…
9:27 PM
Yes
 

« first day (3979 days earlier)      last day (57 days later) »