select hour(timefield) as 'f1' from table1 group by f1

Ivan Smahin ivan_smahin at paradigmasoft.com
Wed Oct 17 12:18:01 CDT 2007


Hello Joseph,

Wednesday, October 17, 2007, 4:35:54 PM, you wrote:

> On Oct 17, 2007, at 8:33 AM, Ivan Smahin wrote:

>> Could you report it to Mantis please?
>>
>> Workaround:
>> Add   field-method   to   the   table   table1.   Method   text  is  -
>> hour(timeField).
>>
>> Now your query will look like this:
>> select m1 from table1 group by m1


> Ok but I find that this works so I'll use this:

> select f1 from (select hour(timefield) as 'f1' from table1) group by f1


Yes, it  could  be solved in this way.
But there is some overhead which can be completely avoided.

Look  -  each  time  you are asking for preparing some tmp table (subquery)
and   indexing f1 field of that tmp table to get some groups. And, finally,
destroy all that objects.

Having  indexed method you are free of such charges. The price is only
index  maintenance on each data modification.

Subquery could be solution for rare queries, but personally, I think
the  method  is better approach anyway. (I don't think we are speaking
about heavy OLTP app. here)

So it is up to you which way you choose. :)

-- 
Best regards,
Ivan Smahin 
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list