Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which statement is 'Better'
Message
 
 
À
12/09/2005 12:32:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6
Divers
Thread ID:
01048319
Message ID:
01048858
Vues:
23
Rich,

>>In SQL server you should avoid SELECT * in a query when none of the fields are actually used or you don't need all of them, you force a read of the data page even if can determine the result only from reading index pages. I/O is slow. Use SELECT 'X' instead.
>>
>
>Thanks for the info.
>
>Since you specified SQL Server, I assume it doesn't matter if the query runs against Fox tables????

Since Fox has gotten the whole row from disk anyway it doesn't matter so much. I've never tried it in VFP, this may be a useful concept to test in VFP9 now that we have a more capable SQL engine.

>When you say SELECT 'X' I'm assuming you mean 'X' to be a literal rather than SELECT somefield???

Yes, just a literal value char(1) is probably about the least intensive thing to use.

>The application I support uses DB2 rather than SQL server. Do you know if the same constraints apply?

I don't have DB2 to play with at all. The key to knowing would be to look at a comparison of the I/O statistics between SELECT * and SELECT 'X'.

>It isn't worth investing time to investigate (unless you're interested in the topic yourself) since the modules involved run an overnight process and it doesn't matter if it takes an extra 10 or 15 minutes to complete (and I think we're talking seconds of difference rather than minutes).

It can be very significant. For us in has greatly reduced contention in the database. How significant needs to be examined on a case by case basis. But I don't know of a way that it would ever be slower than SELECT *.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform