-1

Just interested, maybe someone might know that. If I use lazy load to get all attributes, relations and so on it makes ~350 queries to database it takes about 2 sec to fully render the page. If i make one big query with multiple joins to get all relations I need it makes ~20 queries one is really big, and problem is that this big query first time takes about 10 sec to execute, after that it gets cached and it goes much faster and whole page loads in ~1.5 sec, but problem is that every user has different parameters to that query so for every user first time it goes for 10 sec.. why it goes so long for first time?

user2118788
  • 129
  • 3
  • 5

2 Answers2

0

May I ask, if you are using a stored procedure? I have added a link with some advantages of using a stored procedure https://docs.oracle.com/cd/F49540_01/DOC/java.815/a64686/01_intr3.htm . Can you give some examples of your parameters for different users?

Thanks

mfredy
  • 597
  • 1
  • 8
  • 16
  • No i am not using them, since my website is still evolving i might need to change database structure many times and well currently it's not that big issue, but i am thinking a bit about future. about parameters: blocked users. since i am getting them using other query and. – user2118788 Nov 22 '14 at 20:18
  • @user2118788 If you are going to be fetching huge amounts of results, its best to start using stored procedures as they increase the performance of a query. It is just something to think about. IF the amount of queries increase, it will become a mammoth of a task to convert all queries to stored procedure. – mfredy Nov 24 '14 at 11:07
0

As you gave no information on the data base schema, the data size and other parameters it is very difficult to determine the root cause of the bad performance. However, there is another answer here on StackOverflow that might be a great starting point for further investigation.

In general consider the following questions to start investigating / optimizing:

  • Do you really need all the information you fetch from the DB (at once)?
  • Is the database optimized for the queries you execute?
  • How often do you need to execute the queries and if you cache them, how often does the cache outdate?
Community
  • 1
  • 1
Fabian Kleiser
  • 2,988
  • 3
  • 27
  • 44