I have a question regarding the exact understanding of how PostgreSQL executes a query. Since it's row based it shouldn't matter whether you have a query like Select * from lineitem or Select l_orderkey from lineitem performance wise? Further why is there a difference in measured time between Select count(*) from lineitem and Select * from lineitem since the full table has to be scanned in both cases?
I am measuring the performance like that:
long starttime=System.CurrenMillis();
Statement a = conn.createStatement();
a.setFetchsize(10000);
Resultset rs = a.executeQuery(Query);
while(rs.next()){}
long endTime=System.currentMillis();
System.out.println((endTime-starttime));
I have to set a fetchsize otherwise there will be a Java Heap Space Error, since the table are quite large.
In Addition i was trying to measure the difference to horizontal partitioned table. For that i splitted the table order by orderstatus='O', resulting two tables (ordersO, ordersF) which have both the same size. When comparing the queries Select * from ordersO and Select * from orders where o_orderstatus='O', i was expecting that the first query on the partition only needs half of the time, since it contains only half of the tupel? But it wasnt, the measured time was more or less equal.
Thank you in Advance !