> I never realized that the (lack of) quotes was the problem. What causes
> this slowdown exactly?

All String(char/varchar) fields in the query should have single/double
quotes.
This is something you learn in SQL 101.

> SELECT FROM orderheader WHERE orderno = '60134445'

Where are the fields OR "*" in your query above?
Shouldnt your query be
Select field1, field2 from orderHeader wehre OrderNo='123'
Or
Select * from orderHeader wehre OrderNo='123'

Maybe your DB Drivers are sooo forgiving.
If your OrderNo is always going to be numeric..change it to Int or Big Int.
Basically searching/comparing for Strings are always going to be slow
compared to searching for numeric.

Joe Eugene


> -----Original Message-----
> From: Tony Schreiber [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 02, 2003 5:58 PM
> To: CF-Talk
> Subject: Learned something today (Oracle)
>
>
> I couldn't understand why some queries on tables selecting using the
> primary key (orderno) was taking so long...
>
> In this instance the field in the database is a varchar field, but it's
> holding a numeric value. (Don't ask me why, that's another discussion)
>
> If I did the query like this:
>
> SELECT FROM orderheader WHERE orderno = 60134445
>
> It took like 40 secs!
>
> If I did the query like this:
>
> SELECT FROM orderheader WHERE orderno = '60134445'
>
> Bam! tiny milliseconds... Like it should be.
>
> I never realized that the (lack of) quotes was the problem. What causes
> this slowdown exactly?
>
>
> Tony Schreiber, Senior Partner                  Man and Machine, Limited
> mailto:[EMAIL PROTECTED]                   http://www.technocraft.com
>
> http://www.is300.net The Enthusiast's Home of the Lexus IS300 since 1999
> http://www.simplemessageboard.com    Free Forum Software for Cold Fusion
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to