Re: CHATTER: Re: SQL in plain English -Reply

Author: Bourque, Chad, Chad@teche.net

Posted: 1999-10-06 at 11:28:00

Michael,

Just because it CAN be done in SQL doesn't mean it SHOULD be done in SQL.

For example, I have an app I just had to modify because I first wrote it

using SQL. The SQL-Select took ~ 40 seconds whether it came back with 0, 1,

or 300 records. I changed the code to use this type of process:

Create Cursor ...

IndexSeek(MyCondition)

Scan Rest While MyCondition

Insert Into Cursor ...

EndScan

Using this method causes the time taken to be affected by the number of

records found, but even on the largest result sets, the time is now under ~

4 seconds. Now, part of the reason the SQL lost in this case is because the

Where clause could utilize anywhere from 2 to 7 fields depending on user

input. Although the table has several indexes, it doesn't have composite

indexes for every possibility.

After saying this, please don't think that I'm opposed to SQL. I'm not. In

fact, I use it all over the place and it was my first approach to this

problem. It was only after I learned the way the users would be using the

app (repeated small queries), that I went back and began to look for a way

to speed up processing. So, my final suggestion would be this:

Try both SQL and xBase to see which fits your specific needs in each case.

HTH

Chad Bourque

U.S. Bankruptcy Court - 11th Circuit

Alabama - Northern District - Southern Division

Chad@teche.net

----- Original Message -----

From: Michael Babcock <mbabcock@kepro.org>

To: Multiple recipients of ProFox <profox@leafe.com>

Sent: Wednesday, October 06, 1999 9:55 AM

Subject: CHATTER: Re: SQL in plain English -Reply

Ok, here's my 2 cents:

I believe if it can be done in SQL, then it SHOULD be done in SQL. I had a

time trying to get an xbase algorithm to work recently, and eventually just

wrote simple SQL to do the same thing. My SQL code was 3 pages long,

whereas

the xbase code was over 9 pages long. I think the SQL was easier in this

instance, but of course, it all depends on what's called for in the spec.

Now I suppose someone might prefer to write tons of code if they read a

ComputerWorld article some months ago (I wanted to reference it but I

couldn't

find it!) that said "...programmers should get paid for the number of lines

of

code they write..." or some other crap like that. That paper article

deserved

to be in the restroom to be used for a better purpose, like toilet paper,

although that might have been too good for it. <g>

Someone else (I think Cindy Winegarden) really hit the nail on the head when

she said how it is portable and not Foxpro dependent. That is SO true. And

if for some reason you're in a spot like Matt, you can take your SQL

knowledge

and apply for those many Oracle or other jobs out there where SQL is used.

©1999 Bourque, Chad, Chad@teche.net