|
-
Jan 11th, 2005, 02:32 PM
#1
Frenzied Member
Re: Paging Performance
Okay I think there are resons for SELECT * and I see where a LEFT/RIGHT would be useful on a very complex JOIN; joing 4 - 8 tables, but I always have a key match. That's probably why I wasn't seeing the point. I design my tables so that every key for related data is on the table. Unless like with that contact type field I cut a corner.
If I have Contacts and Employees and an employee is a contact I have a contact key in the employee table. If I have a Sales Rep who is an employee I have a contact and an employee key on the SalesRep table. Now this is easy if you are starting from scratch but I can see and remember it being a @#$%^&*( when working on a long standing data center with 300+ tables. My little app only has 40 though and maybe will get bigger.
As far a SELECT * what if I have a data object that loads info from a table. I have a stored proc that SELECT * FROM X WHERE key = @key. If I add fields I don't have to worry about updating that query. I have to update my UPDATE, INSERTand my object. It's one less thing to worry with. CRUD sucks any way you look at it, why not save myself a little time..?
I rarely want all the data returned unless there is a key match. I don't have any major reports on this app, but yes I know what you mean now. It came back to me. It's a must for proper reports to use LEFT. RIGHT does suck. I just remebered a join I had to write from Sales Reporting about 4 years ago. That thing was evil. it was DB2 also. Ahhhhh DOS
Magiaus
If I helped give me some points.
-
Jan 11th, 2005, 02:52 PM
#2
Banned
Re: Paging Performance
No Select * should NEVER be used. Even if you need all the fields, you should and could (but you're being lazy) list every single field out. Whenever you SELECT * the server performs additional work and is a load on the network traffic. There will come times where you add a field like a bit or a timestamp that you may never need to select from. Then what happens? You have to sit there and modify your SELECT * again and again...
SELECT * is very bad practice, I can send you many more reasons and articles if you'd like. But if you don't care, and the company you work for doesn't care, well that's on you guys. But no way in hell are all of our dba's gonna sit here and write bad code to bite us later on.
Just do it right...
-
Jan 11th, 2005, 05:00 PM
#3
Frenzied Member
Re: Paging Performance
Yep, lazy.... Unfortunatly I'm the DBA, the garaphic desighner, the programmer, the web monkey, and the computer tech. Damn lazy .......
I understand the speed loss though.
Magiaus
If I helped give me some points.
-
Jan 11th, 2005, 05:18 PM
#4
Banned
Re: Paging Performance
 Originally Posted by Magiaus
Yep, lazy.... Unfortunatly I'm the DBA, the garaphic desighner, the programmer, the web monkey, and the computer tech. Damn lazy .......
I understand the speed loss though.
Hey as long as you understand
-
Jan 12th, 2005, 03:03 PM
#5
Re: Paging Performance
SELECT * shouldn't be used, it's sloppy.
But it's not the end of the world.
Woka
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|