• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need advice

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have an application which is just a reporting tool so it just queries a database and fetches a plenty of records.
The database is quite heavy and it takes a significant amount of time for my code to fetch records and display.

To make the situation worse - there are a no of different criterias for the queries based upon different combination of the columns in the table.

my question is that as of now for every combination of criteria i am having a seperate query. is there any other way so that i don't end up with having 100 queries in my code.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U hav specified vague info. Infact the way query can be written lot depends on the nature of the data, how database has been designed etc.

Normally data that is spread across many tables can n retrieved using joins. You may have to use joins and some stored procedures to filter data.

In either case you will have to decide based on the what data out of large set do you want?

So the next time you post give specific details of the nature of data and the datbase design so that one can help you specific to issue.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you build a SQL statement as a String with parts based on your criteria?

Or even better, build ? into your SQL statement and use a prepared statement.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic