CTE, lateral or jsonb_object_agg ?

2023-05-20 Thread Marcos Pegoraro
I have a table like pg_settings, so records have name and value. This select is really fast, just 0.1 or 0.2 ms, but it runs millions of times a day, so ... Then all the time I have to select up to 10 of these records but the result has to be a single record. So it can be done with ... --Using CT

Re: CTE, lateral or jsonb_object_agg ?

2023-05-22 Thread Dominique Devienne
On Sat, May 20, 2023 at 4:43 PM Marcos Pegoraro wrote: > I have a table like pg_settings, so records have name and value. > Hi. Maybe I'm missing something, but why aren't you simply doing: select name, varvalue from sys_var where name = any($1) and binding your 4 (in your examples) or 10

Re: CTE, lateral or jsonb_object_agg ?

2023-05-22 Thread Merlin Moncure
On Sat, May 20, 2023 at 9:43 AM Marcos Pegoraro wrote: > I have a table like pg_settings, so records have name and value. > This select is really fast, just 0.1 or 0.2 ms, but it runs millions of > times a day, so ... > > Then all the time I have to select up to 10 of these records but the > resu