3 ms·
> You should never use "SELECT * FROM SomeTable" to retrieve data because the column order isn't guaranteed. Also, you should always use column names to access
by twic 8y ago
> You should never use "SELECT * FROM SomeTable" to retrieve data because the column order isn't guaranteed. Also, you should always use column names to access data.
If you always use column names, why does column order matter?
- 0xFACEFEED 8y agoIt's not just column order. Sometimes the columns you select affect performance of the query.
- deleted 8y ago[deleted]
- deleted 8y ago[deleted]
- greenleafjacob 8y agoMore precisely, if you only select indexed columns you can read only from the index rather than read from index then read the rest of columns from table. Usually the indices are entirely in memory as well, so it's buttery smooth, whereas a read from the table will probably require a disk read.
- scarface74 8y agoYou’re sending more data than necessary across the wire In general and specifically if someone adds a blob data type it can get really hairy. Another time when you don’t want to do select * is if you are using a database that does columnar storage like Redshift.