Hi,
I'd like to select multiple rows at the same time. Say I have the following query:
select * from car where user_id = ? and car = ?
In the application I'm selecting thousands of cars, which I would like to consolidate to one query and avoid 1k roundtrips to the db
To select several rows at the same time I could do:
select * from car where user_id = ? and car = ?
union
select * from car where user_id = ? and car = ?
...
For postgres I could use values which is nicer to read, and I expect faster as there is only one select to the table
select * from car, (values (?, ?), (?, ?)) as input(user_id, car) where input.user_id = car.user_id and input.car_id = car.car
The problem with this is that I would need to build the values string dynamically depending on the size of my array. Is there a way to do this in the hikari interface? For inserts and updates it does work, but that is because it implements batchExec which is not supported for select queries.
Hi, I'd like to select multiple rows at the same time. Say I have the following query:
In the application I'm selecting thousands of cars, which I would like to consolidate to one query and avoid 1k roundtrips to the db To select several rows at the same time I could do:
For postgres I could use values which is nicer to read, and I expect faster as there is only one select to the table
The problem with this is that I would need to build the values string dynamically depending on the size of my array. Is there a way to do this in the hikari interface? For inserts and updates it does work, but that is because it implements batchExec which is not supported for select queries.
Thanks