4 ms·
Crikey. SELECT * can be bad for the following reasons: - returning more data than you need over a network connection can be a bottleneck. The ORM/java prog wr
by trollied 13y ago
Crikey.
SELECT * can be bad for the following reasons:
- returning more data than you need over a network connection can be a bottleneck. The ORM/java prog written by a programmer that doesn't care may only need a few columns. Tables can be very wide, especially when CLOB/BLOBs are involved
- Stored procedures, functions and triggers that use SELECT * may break horribly when columns are added or removed from tables, views or materialised views
- Table types (collection and record types) will break if any column redefinition occurs
- It shows a lack of understanding of the data by the developer. This may, in turn, cause further issues
Proper schema design and understanding of the data involved is key when working with databases. The existence of NoSQL and the general dumbing down of Computer Science degrees, plus the teaching of ORMs has caused endless problems. The need for NoSQL in the first place was possibly caused by the use of high level programming languages where you didn't need to know the data - you just fetch it all, then piss around with it in ruby/whatever, then fetch it again & again until you're done.
Rant over ;)