Timeline for PostgreSQL return default row on empty result set
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 19, 2023 at 6:48 | comment | added | Sergey Telshevsky | The performance question here is more theoretical for now, as the usage of this query is during an insertion of records to the queue type table, about 100/s is the maximum estimated, but needs to be tested in real life scenarios | |
Jul 19, 2023 at 6:37 | vote | accept | Sergey Telshevsky | ||
Jul 19, 2023 at 6:35 | comment | added | Sergey Telshevsky | No, the value can't be NULL in my case, but this works really well. So the part I missed is to use coalesce the way you did. Thank you. Considering the performance - well this undoubtedly will be faster than my case as it doesn't execute the query on the table twice (I don't think optimization happens here). | |
Jul 18, 2023 at 21:29 | history | answered | jjanes | CC BY-SA 4.0 |