Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

specify db fields 2

Status
Not open for further replies.

TruthInSatire

Programmer
Aug 12, 2002
2,964
US
I always specify the fields i'm using even if i pull back all the fields so I or anyone who needs to read the code can easily see what data is being used.

However I haven't been able to find firm documentation as far as what kind of proformance benefit or hinderance this produces. Can anyone give a link?

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Hi TIS,

I had similar problems finding a definitive link, but I think the common sense approach works.

By way of analogy: You go into the supermarket, and you're shopping for apples and oranges. You don't fill your cart with every fruit from the produce section; that would make the cart hard to push, and is not really what you had in mind when you came into the supermarket.

From a bits-and-bytes standpoint, column-specific queries are lighter then asterisk queries, take up less network space, and perform better overall. Imagine a table with a binary and a couple of text fields containing images, the Encyclopaedia Brittanica, whatever. If all you want is some descriptive information from other fields, it doesn't make any sense to carry all those books around with you.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Eschewing obfuscation diurnally.
 
Thanks Philhege,
good analogy.

My problem is I do a lot of common sence stuff that's "Best practice" but when i suggest to other people

"you should do it this way"
"why"
"well, its best practice/improves proformance/common sence/etc.."
"Says who?"
"um, i read it somewhere" (this doesn't fly most of the time)
"read it where? quit making stuff up, not everyone has to program like you..."

I know i've read them somewhere, in books or forums or whatever. I don't come up with this stuff on my own and call it "best practice", but can't cite exact examples when I need to prevent arguing.



We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
TruthInSatire, well, best practice really is someone's opinion on how to do something (better). I did a google search on 'best coldfusion practices' and while majority of them say to do certain things the same way, it's hard to show a document to someone who asks for some kind of verification.

Some programmers (mostly beginers) are lazy and don't wanna type in ALL the fields, esp when its soooo much easier to do select *

What I did to demonstrate to someone at my last job was run several queries, one as select * and another with fieldnames entered in, and in SQL Server from Profiler showed them the times it took to run those queries. The best effect is a visual one.


____________________________________
Just Imagine.
 
Not all best practices are "opinions". Indenting code variable naming, stuff like that, sure... but i'm talking about proformance that should be proven.

I had to take my son to the doctor the yesterday. in conversation the doctor said,

"That's ok i'm married and i have to take my wife to the doctor too."

The context of that statement is a long story, but the point is even though he's a doctor his wife doesn't want to hear it from him. I'm in the same situation at work; if "I" prove it, i still won't be listened to (no one likes a know-it-all). I need an outside source.

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
In searching around, I really couldn't find any official documentation, but here are a few links to some articles that may have what you're looking for.

This is just a list of CF articles on the MM website

There are a few performance tips towards the bottom of this one.

Here's an article that covers a bunch of (good!) stuff, but nothing about "Select *"

This one is interesting! It's a CF code review program by ActiveSoftware that scans your CF application and checks for "security, performance, accessibility, style, and bug related issues." I you look at the "30 built-in rules", you'll see one for "Select *" with an explanation of why it's bad.



Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Awesome, I'm a bit busy now, telling people how to code :p

But, i'll get a chance to look at it later. thanks!

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
It sounds like TruthInSatire's argumentative colleagues would question the authority of these, too. You just can't win with some people; they'd doubt the advice even if Dr. Edgar Codd himself came back from the dead, walked into their cubicle, and gave them the word.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Eschewing obfuscation diurnally.
 
I think its more that TruthInSatire's colleagues are looking for documents written by Macromedia (or now Adobe).

It won't matter how many links or the number of articles TruthInSatire gives his colleagues, they'll just question that as well.

Even if Ben Forta, the all mighty genious of CF, told them they'd be skepticle.


____________________________________
Just Imagine.
 
Macradobe has zippo to do with how SQL performs. That's up to the DB engine purveyors, the connection providers, and the nuts-and-bolts logic behind garden-variety SQL. If TIS' buddies don't understand this fundamental fact, I wouldn't waste my time trying to provide verification.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Eschewing obfuscation diurnally.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top