🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.pascal.delphi.databases
2 messages
2 total messages Started by Bill Artemik Thu, 04 Nov 1999 00:00
Really S L O o o o o o o o o o o Update SQL - Need help, please
#35
Author: Bill Artemik
Date: Thu, 04 Nov 1999 00:00
27 lines
1587 bytes
Part of my application's SQL is to update values of a sub quers with
zeroes where field values are null:

UPDATE MyTable
SET MyField = 0
WHERE MyField IS NULL

There are about 440,000 records in this dBase table that need to be
checked and zeroed out if need be.

This update process takes about 18 minutes in Local SQL.

If I run this in Delphi as procedural code and using a TTable it takes
less than half that time

I don't recall EVER having procedural code beat a SQL statement (well,
a well-constructed SQL statement, that is...)

Is there something else I can do to speed this up?
Bill Artemik
Programmer / Analyst
Droste Consultants, Inc.
bill@droste1.com


"There are THREE kinds of people in the world...
      Those that can count and those that can't."
Re: Really S L O o o o o o o o o o o Update SQL - Need help, please
#34
Author: Jef Charlier
Date: Sat, 06 Nov 1999 00:00
121 lines
4572 bytes
If you use dbase tables and you need speed, you can do heavy actions with
the delphi pascal routines of Halcyon www.grifsolu.com.
This package has a table component with methods and property's but also pure
pascal code without using the "visual component" in gs6_shel.pas. You can
switch to the pascal code without loosing the settings of your component by
setting property active:=false;

1) Here an example with the component

HData4CR: THalcyonDataSet;
....
procedure SetIndexHData4Cr(bMessage:boolean);
var sf,sfi : shortstring;
begin
  sf:= Frm4DBF.HData4Cr.Tablename;
  sfi:=mdxFN(sf);
  if not fileexists(sfi) then
  begin
    MessageBeep($FFFFffff);
    if bMessage then
      MessageDlg('Reindexing cross , press button .. end
wait',mtInformation,[mbOK],0);
    application.processmessages;

Frm4DBF.HData4Cr.IndexOn(sfi,'ALPHA','upper(ALPHA)','',Duplicates,Ascending)
; // als de TAG nog niet bestaat
  end;

  Frm4DBF.HData4Cr.Index(sfi,'ALPHA');
end;
....
HData4Cr.TableName:=sDBcross; // als er voordien nooit een bestond
HData4Cr.IndexName:='';
HData4Cr.Active:=true;
HData4Cr.Index('','');

2) Here an example with pure pascal code

procedure transferDatafrom3Files(sdbgrif: shortstring);
begin
  sf:=sdbPB;   // fsel, skz, langtext
  sfi:=mdxFN(sf);

  TableR:= TgsDBFTable.Create(sdbPB,'',true,false); // readwrite no sharing
  with TableR do
  begin
    indexon(sfi,'ALPHA','ALPHA','',Duplicates,Ascending); // dupli !!
    index(sfi,'ALPHA');
    first;

    transfer2SKZtoGRAF(sdbgrif); // eerste voorrang hier voor ANA
  end;
  TableR.free;
.. and so on


----- Original Message -----
From: Bill Artemik <bill@droste1.com>
Newsgroups:
comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop,bor
land.public.delphi.database.sqlservers
Sent: Thursday, November 04, 1999 4:58 PM
Subject: Really S L O o o o o o o o o o o Update SQL - Need help, please


> Part of my application's SQL is to update values of a sub quers with
> zeroes where field values are null:
>
> UPDATE MyTable
> SET MyField = 0
> WHERE MyField IS NULL
>
> There are about 440,000 records in this dBase table that need to be
> checked and zeroed out if need be.
>
> This update process takes about 18 minutes in Local SQL.
>
> If I run this in Delphi as procedural code and using a TTable it takes
> less than half that time
>
> I don't recall EVER having procedural code beat a SQL statement (well,
> a well-constructed SQL statement, that is...)
>
> Is there something else I can do to speed this up?
> Bill Artemik
> Programmer / Analyst
> Droste Consultants, Inc.
> bill@droste1.com
>
>
> "There are THREE kinds of people in the world...
>       Those that can count and those that can't."
Bill Artemik <bill@droste1.com> wrote in message
news:3823ac1e.9260953@news3.newscene.com...
> Part of my application's SQL is to update values of a sub quers with
> zeroes where field values are null:
>
> UPDATE MyTable
> SET MyField = 0
> WHERE MyField IS NULL
>
> There are about 440,000 records in this dBase table that need to be
> checked and zeroed out if need be.
>
> This update process takes about 18 minutes in Local SQL.
>
> If I run this in Delphi as procedural code and using a TTable it takes
> less than half that time
>
> I don't recall EVER having procedural code beat a SQL statement (well,
> a well-constructed SQL statement, that is...)
>
> Is there something else I can do to speed this up?
> Bill Artemik
> Programmer / Analyst
> Droste Consultants, Inc.
> bill@droste1.com
>
>
> "There are THREE kinds of people in the world...
>       Those that can count and those that can't."
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads