0

I asked myself if a full select like

SELECT('*') FROM table ...

is more performant than

SELECT('id,bla,blub') FROM table

or vice versa (with larger amount of rows and without joins or something). Has anyone benchmarked/tested this? I thought it could be, because it's just like "give me everything" and it doesn't need to "search" for the right columns (and I also get the columns I wanted). On the other hand if I specified the columns, there is less data that has to be given out. So what is/could be more performant?

Faenor
  • 633
  • 8
  • 23
  • 2
    Do you really mean select(' * ') and not select * ? it is not the same thing. select (' * ') will show you a `*` for each existed row. – MrSimpleMind Jan 04 '14 at 14:11
  • Additionally (to what MrSimpleMind) has written: there is no use whatsoever in putting parentheses around the column list. Btw: the query will return `*` for every row and the second one will return the (same) character sequence `id,bla,blub` for each row. –  Jan 04 '14 at 14:22
  • sorry, maybe a bit wrong syntax because of a framework that I use :) of course * should return all rows, and the 2nd should only return these columns of the rows. – Faenor Jan 04 '14 at 15:40

1 Answers1

0

Well, to answer this we would have to straight out what we mean when we talk about performance.

To fetch "some" extra columns does normaly not cost so much in performace. But it would cost in form of bandwidth and thats why you always should limit your questions to just what is needed (if you don´t have any special thought behind it).

carleson
  • 728
  • 1
  • 5
  • 14