473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

low performance

Hi ng

I open the following recordset in a module - and the performance is
very
slow - anyone who has an idea to speed it up. (The table is indexed)
Here
is the code:

strDatestart = Format([Forms]![frm_reklamationer]![txtStartInterval],
"mm/dd/yy")
strDatestop = Format([Forms]![frm_reklamationer]![txtStopInterval],
"mm/dd/yy")
strPeriodeAS = "Format(DateAdd('d', -1, [Dato]), 'ww') as Week_No"
strPeriode = "Format(DateAdd('d', -1, [Dato]), 'ww')"

strSQL = "SELECT " & strPeriodeAS & ", Sum(Tbl_Production.figures) AS
SumOffigures " _
& "FROM Tbl_Production WHERE Dato >= #" & strDatestart & "# And
Dato
<= #" & strDatestop & "# " _
& "GROUP BY Year([Dato]), " & strPeriode _
& "ORDER BY Year([Dato]), " & strPeriode

Set rst1 = db.OpenRecordset(strSQL)

Thanks in advance
Jens

Oct 17 '06 #1
6 1264
Bri


JensT wrote:
Hi ng

I open the following recordset in a module - and the performance is
very
slow - anyone who has an idea to speed it up. (The table is indexed)
Here
is the code:

strDatestart = Format([Forms]![frm_reklamationer]![txtStartInterval],
"mm/dd/yy")
strDatestop = Format([Forms]![frm_reklamationer]![txtStopInterval],
"mm/dd/yy")
strPeriodeAS = "Format(DateAdd('d', -1, [Dato]), 'ww') as Week_No"
strPeriode = "Format(DateAdd('d', -1, [Dato]), 'ww')"

strSQL = "SELECT " & strPeriodeAS & ", Sum(Tbl_Production.figures) AS
SumOffigures " _
& "FROM Tbl_Production WHERE Dato >= #" & strDatestart & "# And
Dato
<= #" & strDatestop & "# " _
& "GROUP BY Year([Dato]), " & strPeriode _
& "ORDER BY Year([Dato]), " & strPeriode

Set rst1 = db.OpenRecordset(strSQL)

Thanks in advance
Jens
I'm guessing, but I would suspect that it is the Group By on a Function.
Hmm, I'm also wondering how it even works at all. You have Year([Dato])
in the Group By and Order BY but not in the Select part.
Without knowing the table structure I can't say more.

--
Bri

Oct 18 '06 #2
JensT wrote:
Hi ng

I open the following recordset in a module - and the performance is
very
slow - anyone who has an idea to speed it up. (The table is indexed)
Here
is the code:

strDatestart = Format([Forms]![frm_reklamationer]![txtStartInterval],
"mm/dd/yy")
strDatestop = Format([Forms]![frm_reklamationer]![txtStopInterval],
"mm/dd/yy")
strPeriodeAS = "Format(DateAdd('d', -1, [Dato]), 'ww') as Week_No"
strPeriode = "Format(DateAdd('d', -1, [Dato]), 'ww')"

strSQL = "SELECT " & strPeriodeAS & ", Sum(Tbl_Production.figures) AS
SumOffigures " _
& "FROM Tbl_Production WHERE Dato >= #" & strDatestart & "# And
Dato
<= #" & strDatestop & "# " _
& "GROUP BY Year([Dato]), " & strPeriode _
& "ORDER BY Year([Dato]), " & strPeriode

Set rst1 = db.OpenRecordset(strSQL)

Thanks in advance
Jens
OK I'll stab..

Your table is indexed -- on what column(s)?

How many records are you parsing?

This might be a situation where it makes sense to include a dependent
column in your table to store the calculated year. Index that. How's the
performance now?

--
Smartin
Oct 18 '06 #3
Hi Smartin

The query parses about 347.000 records.

The table contains 9 Fields, and is indexed on the field [Dato] - which
is a date field.
I'm not sure what you mean by "dependend" column, but I guess you mean
I should update the table with a column with the weeknumber =
Format(DateAdd('d', -1, [Dato]), 'ww') -

I would just like not to do that since it is a table with almost one
million records.

Thanks
Jens
Smartin skrev:
JensT wrote:
Hi ng

I open the following recordset in a module - and the performance is
very
slow - anyone who has an idea to speed it up. (The table is indexed)
Here
is the code:

strDatestart = Format([Forms]![frm_reklamationer]![txtStartInterval],
"mm/dd/yy")
strDatestop = Format([Forms]![frm_reklamationer]![txtStopInterval],
"mm/dd/yy")
strPeriodeAS = "Format(DateAdd('d', -1, [Dato]), 'ww') as Week_No"
strPeriode = "Format(DateAdd('d', -1, [Dato]), 'ww')"

strSQL = "SELECT " & strPeriodeAS & ", Sum(Tbl_Production.figures) AS
SumOffigures " _
& "FROM Tbl_Production WHERE Dato >= #" & strDatestart & "# And
Dato
<= #" & strDatestop & "# " _
& "GROUP BY Year([Dato]), " & strPeriode _
& "ORDER BY Year([Dato]), " & strPeriode

Set rst1 = db.OpenRecordset(strSQL)

Thanks in advance
Jens

OK I'll stab..

Your table is indexed -- on what column(s)?

How many records are you parsing?

This might be a situation where it makes sense to include a dependent
column in your table to store the calculated year. Index that. How's the
performance now?

--
Smartin
Oct 19 '06 #4
Hi Bri

Thanks for your answer.

The table contains a million records, 9 fields. One field is [dato]
which is a date field, another is figures - which is a number fields.
The [dato] field is indexed.

Thx
Jens
Bri skrev:
JensT wrote:
Hi ng

I open the following recordset in a module - and the performance is
very
slow - anyone who has an idea to speed it up. (The table is indexed)
Here
is the code:

strDatestart = Format([Forms]![frm_reklamationer]![txtStartInterval],
"mm/dd/yy")
strDatestop = Format([Forms]![frm_reklamationer]![txtStopInterval],
"mm/dd/yy")
strPeriodeAS = "Format(DateAdd('d', -1, [Dato]), 'ww') as Week_No"
strPeriode = "Format(DateAdd('d', -1, [Dato]), 'ww')"

strSQL = "SELECT " & strPeriodeAS & ", Sum(Tbl_Production.figures) AS
SumOffigures " _
& "FROM Tbl_Production WHERE Dato >= #" & strDatestart & "# And
Dato
<= #" & strDatestop & "# " _
& "GROUP BY Year([Dato]), " & strPeriode _
& "ORDER BY Year([Dato]), " & strPeriode

Set rst1 = db.OpenRecordset(strSQL)

Thanks in advance
Jens

I'm guessing, but I would suspect that it is the Group By on a Function.
Hmm, I'm also wondering how it even works at all. You have Year([Dato])
in the Group By and Order BY but not in the Select part.
Without knowing the table structure I can't say more.

--
Bri
Oct 19 '06 #5
Bri
JensT wrote:
Hi Bri

Thanks for your answer.

The table contains a million records, 9 fields. One field is [dato]
which is a date field, another is figures - which is a number fields.
The [dato] field is indexed.

Thx
Jens
I still suspect that it is using a function in the Group By and Order
By. It has to call the function for every record that match the
criteria. It may even call it more than once per record. Its getting
late here so I'm a bit foggy. I'll take a look at this again tomorrow
and see if there is some way to make this more efficient.

--
Bri

Oct 19 '06 #6
Hello JensT,

Yes that is what I am suggesting. I think Bri is right -- you are
calling the Year() function on every record, possibly multiple times,
which is sure to slow performance.

It might be worth the effort to add a column to your table to store the
calculated value (that's what I meant by "dependent column").

All I can offer from my own experience is I have a situation where I
need to process about 350,000 rows grouping on the Month() value of a
Date field. It works much better when I have the Month stored as a
separate, calculated column. Your mileage may vary.

Hope this helps.

JensT wrote:
Hi Smartin

The query parses about 347.000 records.

The table contains 9 Fields, and is indexed on the field [Dato] - which
is a date field.
I'm not sure what you mean by "dependend" column, but I guess you mean
I should update the table with a column with the weeknumber =
Format(DateAdd('d', -1, [Dato]), 'ww') -

I would just like not to do that since it is a table with almost one
million records.

Thanks
Jens
Smartin skrev:
>JensT wrote:
>>Hi ng

I open the following recordset in a module - and the performance is
very
slow - anyone who has an idea to speed it up. (The table is indexed)
Here
is the code:

strDatestart = Format([Forms]![frm_reklamationer]![txtStartInterval],
"mm/dd/yy")
strDatestop = Format([Forms]![frm_reklamationer]![txtStopInterval],
"mm/dd/yy")
strPeriodeAS = "Format(DateAdd('d', -1, [Dato]), 'ww') as Week_No"
strPeriode = "Format(DateAdd('d', -1, [Dato]), 'ww')"

strSQL = "SELECT " & strPeriodeAS & ", Sum(Tbl_Production.figures) AS
SumOffigures " _
& "FROM Tbl_Production WHERE Dato >= #" & strDatestart & "# And
Dato
<= #" & strDatestop & "# " _
& "GROUP BY Year([Dato]), " & strPeriode _
& "ORDER BY Year([Dato]), " & strPeriode

Set rst1 = db.OpenRecordset(strSQL)

Thanks in advance
Jens
OK I'll stab..

Your table is indexed -- on what column(s)?

How many records are you parsing?

This might be a situation where it makes sense to include a dependent
column in your table to store the calculated year. Index that. How's the
performance now?

--
Smartin

--
Smartin
Oct 19 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Brian Patterson | last post by:
I have noticed in the book of words that hasattr works by calling getattr and raising an exception if no such attribute exists. If I need the value in any case, am I better off using getattr...
12
by: Fred | last post by:
Has anyone a link or any information comparing c and c++ as far as execution speed is concerned? Signal Processing algorithms would be welcome... Thanks Fred
12
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I...
6
by: teedilo | last post by:
We have an application with a SQL Server 2000 back end that is fairly database intensive -- lots of fairly frequent queries, inserts, updates -- the gamut. The application does not make use of...
5
by: Scott | last post by:
I have a customer that had developed an Access97 application to track their business information. The application grew significantly and they used the Upsizing Wizard to move the tables to SQL...
115
by: Mark Shelor | last post by:
I've encountered a troublesome inconsistency in the C-language Perl extension I've written for CPAN (Digest::SHA). The problem involves the use of a static array within a performance-critical...
13
by: bjarne | last post by:
Willy Denoyette wrote; > ... it > was not the intention of StrousTrup to the achieve the level of efficiency > of C when he invented C++, ... Ahmmm. It was my aim to match the performance...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
7
by: Michael D. Ober | last post by:
When calling Enqueue, the internal array may need to be reallocated. My question is by how much? In the old MFC array classes, you could tell MFC how many additional elements to add to the array...
1
by: jvn | last post by:
I am experiencing a particular problem with performance counters. I have created a set of classes, that uses System.Diagnostics.PerformanceCounter to increment custom performance counters (using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.