 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Cenk Guest
|
Posted: Fri Feb 24, 2006 3:03 pm Post subject: Slow |
|
|
hi,
i have app. 30 billion data in sql server db and i write them into a txt
file.But its too time consuming, is there a faster way to do this?
thanks |
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Fri Feb 24, 2006 3:03 pm Post subject: Re: Slow |
|
|
Cenk wrote:
| Quote: | i have app. 30 billion data in sql server db and i write them into a txt
file.But its too time consuming, is there a faster way to do this?
|
Can we see your code ?
Jonathan |
|
| Back to top |
|
 |
Cenk Guest
|
Posted: Fri Feb 24, 2006 3:03 pm Post subject: Re: Slow |
|
|
String tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9;
int count;
TQuery *CountQuery;
CountQuery= new TQuery (this);
CountQuery->DatabaseName = "Raw";
CountQuery->SQL->Add ("select COUNT(bid) from [EUR/USD]");
CountQuery->Open ();
count = CountQuery->FieldByName ("COLUMN1")->AsInteger;
CountQuery->SQL->Clear();
CountQuery->SQL->Add ("select [fTime],[fID],CAST([fName] As
varchar(12)) As fName,[bid],[ask],[high],[low],[bidTrend],[askTrend] from
[EUR/USD]");
CountQuery->Open ();
ofstream writefile ("eurusdfull.txt",ios::app);
if (writefile.is_open())
{
for (int i = 0;i<count ;i++)
{
tmp1 = IntToStr(CountQuery->FieldByName ("fID")->AsInteger);
tmp2 = CountQuery->FieldByName ("fName")->AsString;
tmp3 = FloatToStr(CountQuery->FieldByName ("bid")->AsFloat);
tmp4 = FloatToStr(CountQuery->FieldByName ("ask")->AsFloat);
tmp5 = FloatToStr(CountQuery->FieldByName ("high")->AsFloat);
tmp6 = FloatToStr(CountQuery->FieldByName ("low")->AsFloat);
tmp7 = FloatToStr(CountQuery->FieldByName
("bidTrend")->AsInteger);
tmp8 = FloatToStr(CountQuery->FieldByName
("askTrend")->AsInteger);
tmp9 = DateTimeToStr(CountQuery->FieldByName
("fTime")->AsDateTime);
writefile <<
tmp9.c_str()<<"\t"<<tmp1.c_str()<<"\t"<<tmp2.c_str()<<"\t"<<tmp3.c_str()<<"\t"<<tmp4.c_str()<<"\t"<<tmp5.c_str()<<"\t"<<tmp6.c_str()<<"\t"<<tmp7.c_str()<<"\t"<<tmp8.c_str()<<"\n";
CountQuery->Next ();
}
writefile.close();
CountQuery->Close ();
CountQuery->Free ();
}
else
cout << "Unable to open file"; |
|
| Back to top |
|
 |
Cenk Guest
|
Posted: Fri Feb 24, 2006 4:03 pm Post subject: Re: Slow |
|
|
this is the original code, actually i m trying to find a better one.its 34
mins and still continuing. |
|
| Back to top |
|
 |
Alan Bellingham Guest
|
Posted: Fri Feb 24, 2006 4:03 pm Post subject: Re: Slow |
|
|
"Cenk" <cenk1536 (AT) yahoo (DOT) com> wrote:
| Quote: | file size is 2,5 GB and row size is app 34 billions
|
You've got 13 rows per byte of database?!
Alan Bellingham
--
ACCU Conference 2006 - 19-22 April, Randolph Hotel, Oxford, UK |
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Fri Feb 24, 2006 4:03 pm Post subject: Re: Slow |
|
|
Cenk wrote:
| Quote: | this is the original code, actually i m trying to find a better one.its 34
mins and still continuing.
|
I pasted code below my post with the file writing stripped out of your code.
How fast does that run ?
Jonathan |
|
| Back to top |
|
 |
John Blackburn Guest
|
Posted: Fri Feb 24, 2006 4:03 pm Post subject: Re: Slow |
|
|
"Cenk" <cenk1536 (AT) yahoo (DOT) com> wrote in message
news:43ff226c$1 (AT) newsgroups (DOT) borland.com...
| Quote: | i m talking about 34,000,000 of data!
|
bytes or records ? |
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Fri Feb 24, 2006 4:03 pm Post subject: Re: Slow |
|
|
Alan Bellingham wrote:
| Quote: | You've got 13 rows per byte of database?!
|
Thats excellent compression, I'd better get that code and patent it :-)
Jonathan |
|
| Back to top |
|
 |
Cenk Guest
|
Posted: Fri Feb 24, 2006 4:03 pm Post subject: Re: Slow |
|
|
| Quote: | You've got 13 rows per byte of database?!
|
So What?? |
|
| Back to top |
|
 |
Cenk Guest
|
Posted: Fri Feb 24, 2006 4:04 pm Post subject: Re: Slow |
|
|
i need solution not laughing  |
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Fri Feb 24, 2006 4:04 pm Post subject: Re: Slow |
|
|
Cenk wrote:
| Quote: | well i could not try your code because mine is still going & going!
|
Ctrl+Alt+Delete and kill it :-)
Jonathan |
|
| Back to top |
|
 |
Cenk Guest
|
Posted: Fri Feb 24, 2006 4:04 pm Post subject: Re: Slow |
|
|
| i m talking about 34,000,000 of data! |
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Fri Feb 24, 2006 4:04 pm Post subject: Re: Slow |
|
|
Cenk wrote:
How fast does this code run compared to the original code: ?
String tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9;
int count;
TQuery *CountQuery;
CountQuery= new TQuery (this);
CountQuery->DatabaseName = "Raw";
CountQuery->SQL->Add ("select COUNT(bid) from [EUR/USD]");
CountQuery->Open ();
count = CountQuery->FieldByName ("COLUMN1")->AsInteger;
CountQuery->SQL->Clear();
CountQuery->SQL->Add ("select [fTime],[fID],CAST([fName] As
varchar(12)) As fName,[bid],[ask],[high],[low],[bidTrend],[askTrend] from
[EUR/USD]");
CountQuery->Open ();
for ( int i = 0; i < count; ++i )
{
tmp1 = IntToStr(CountQuery->FieldByName ("fID")->AsInteger);
tmp2 = CountQuery->FieldByName ("fName")->AsString;
tmp3 = FloatToStr(CountQuery->FieldByName ("bid")->AsFloat);
tmp4 = FloatToStr(CountQuery->FieldByName ("ask")->AsFloat);
tmp5 = FloatToStr(CountQuery->FieldByName ("high")->AsFloat);
tmp6 = FloatToStr(CountQuery->FieldByName ("low")->AsFloat);
tmp7 = FloatToStr(CountQuery->FieldByName
("bidTrend")->AsInteger);
tmp8 = FloatToStr(CountQuery->FieldByName
("askTrend")->AsInteger);
tmp9 = DateTimeToStr(CountQuery->FieldByName
("fTime")->AsDateTime);
CountQuery->Next ();
}
CountQuery->Close ();
CountQuery->Free ();
Jonathan |
|
| Back to top |
|
 |
Cenk Guest
|
Posted: Fri Feb 24, 2006 4:04 pm Post subject: Re: Slow |
|
|
| file size is 2,5 GB and row size is app 34 billions |
|
| Back to top |
|
 |
John Blackburn Guest
|
Posted: Fri Feb 24, 2006 4:04 pm Post subject: Re: Slow |
|
|
"Cenk" <cenk1536 (AT) yahoo (DOT) com> wrote in message
news:43ff1e32$1 (AT) newsgroups (DOT) borland.com...
| Quote: | this is the original code, actually i m trying to find a better one.its 34
mins and still continuing.
|
by "30 billion data", do you mean 30 billion records or 30 GByte database
file size and, if the latter, how many records are we talking about ? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|