First, I'm new to DB programming and the following seems to me a little strange.
I have the following very large table (details):
id name name_details
PK varchar(32) varchar(32)
--------------------------------
1 'core' 'xAj6l3Fg5d'
2 'core' '8lEfs01nkf'
3 'smt' 'oij3Gll4d6'
...................................
I need to write the following query:
SELECT name_details
FROM details
WHERE name = 'core' OR name = 'smt'
I've noticed that if I open two separate windows in PGAdmin and execute these two queries:
SELECT name_details
FROM details
WHERE name = 'core'
SELECT name_details
FROM details
WHERE name = 'smt'
The execution time will be almost the same as I if were executed the only one query. So, I presume that every SQL connection is handled in their own thread. I have 16-core system.
Question: is it generally useful to split the whole query in smaller parts (16) and execute any part in the different thread? Is it generally useful for performing queries handling large amount of data?
Particularly, I'd use ThreadPoolExecutor(Runtime.getRuntime().availableProcessors() \*cores*\, \* other_params *\) for handling that.