Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8875965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:06:24+00:00 2026-06-14T19:06:24+00:00

i have an application written in Play Framework 1.2.5 and i am using H2

  • 0

i have an application written in Play Framework 1.2.5 and i am using H2 File as database.

The application has a “Sales” Table that gets about 1000 rows per day. i have about 5 years of data in it (usually 2-3 years data will be available) so basically i have a table with 1.5Mil+ data in my test machine.

My problem is, the client asks for data like “give me the sum os sales between dates and group bu product type and sales type”. So i have to make somehing like a select query with 2 groups and date range.

As the table grows larger, the select query performance is decreasing dramatically. What can i do to get better results?

I have created another table with summarized sales like hourly, daily and monthly, but there are functions that i mush search from the sales table.

the first application was written in c# (asp.net webservice) and ms-sql server with stored procedures as database, these operationg were quick as few seconds top. and i had the same about of data, even i wasnt using any summarized table the make queries quicker.

I know, a dedicated server application will always be faster than an embedded server, but i think there must be a way to improve the performance of this query.

Is there any optimizations that i can do over H2 engine.

Becuase of concurrency issues, i had to enable “MVCC” on H2 server, could this be a problem on performance?

Thanks for reaindg and spending your time.

**Edit For people who use Play Framework 1.2.x:

i’ve just added @Index(name=”sales_columnname_index”) annotation on each column i want to add to index and now H2 engine is working even faster than my old mssql+asp.net application.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:06:24+00:00Added an answer on June 14, 2026 at 7:06 pm

    You have to do the optimizations by creating the correct indexes.

    For example for this

    The client asks for data like “give me the sum os sales between dates and group bu product type and sales type”. So i have to make somehing like a select query with 2 groups and date range

    you need an index (not necessarily unique) over the columns product type, sales type and time, like this:

    create index sales_table_i2 on sales_table(product_type, sales_type, sales_time);
    

    In your HQL query you have to mention the index columns in a way to make sure the database uses this index, for example

    select sum(amount) from SalesTable where salesTime >= :start and salesTime < :end group by productType, salesType
    

    or

    from SalesTable where productType = :prod and salesType = :sale and salesTime >= :start and salesTime < :end
    

    In the second example then you have to sum up the mounts in your Java code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a prototype application (RESTful web service database front-end) that is written using
I have an application written using C++ Builder 5 that uses the TDocument class.
I have web application written in java using Eclipse. It has just one servlet
We have an old (written in CakePHP 1.1!) application that has started groaning under
I have application written in Java that is using EJB3 + Toplink. I'm using
I have an application written using Prism 4.0. It has lots of Views which
I have an application written on Play Framework 1.2.4 with Hibernate(default C3P0 connection pooling)
I have a desktop application written in Ruby that is using GTK2. It's just
I have this application written in JSF 2.0 facelets and it has the following
I have an application written in C# that invokes some C code as well.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.