Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread TDBISAMQuery.MaxRowCount and GROUP BY
Wed, Jan 21 2015 7:48 AMPermanent Link

Markus Gnam

Hi,

I used to use TDBISAMQuery.MaxRowCount set to 300.000 because I assumed there were no interferences with GROUP BY.
From the documentation: "This property does not respect any DISTINCT, GROUP BY, or ORDER BY clauses in the SQL Statement."

However, using the following query I received wrong results (too few records were counted):
SELECT COUNT(*), Corrector FROM trkid WHERE AssignDate IS NOT NULL GROUP BY Corrector

I've reset now to MaxRowCount = -1, because then I get correct results. However, I'd like to ask if this is the expected behaviour?

Thank you very much!
Markus
Wed, Jan 21 2015 8:24 AMPermanent Link

Raul

Team Elevate Team Elevate

<<
Markus Gnam wrote:
I used to use TDBISAMQuery.MaxRowCount set to 300.000 because I assumed there were no interferences with GROUP BY.
From the documentation: "This property does not respect any DISTINCT, GROUP BY, or ORDER BY clauses in the SQL Statement."
However, using the following query I received wrong results (too few records were counted):
SELECT COUNT(*), Corrector FROM trkid WHERE AssignDate IS NOT NULL GROUP BY Corrector
I've reset now to MaxRowCount = -1, because then I get correct results. However, I'd like to ask if this is the expected behaviour?
>>

I have not used this myself but my interpretation of "does not respect GROUP BY" is that it will first apply the MaxRowCount and then other operations like group by.

Hence the select will first limit itself to 300.000 records and only then apply group by thus working on subset of data.

IMHO behavior is as documented and expected.


Raul
Thu, Jan 22 2015 5:36 AMPermanent Link

Markus Gnam

Raul wrote:
<<
I have not used this myself but my interpretation of "does not respect GROUP BY" is that it will first apply the MaxRowCount and then other operations like group by.
Hence the select will first limit itself to 300.000 records and only then apply group by thus working on subset of data.
IMHO behavior is as documented and expected.
Raul
>>

Hi Raul,
thank you! You are right, my main misunderstanding was that I assumed MaxRowCount would apply to the number of rows returned in the result set and not necessarily to the number of rows retrieved by the Select statement.
Best wishes, Markus
Image