on ‎2013 Jan 09 7:16 AM
After starting the database when the first query takes longer to run. For example, a simple query to get the date of the last sale, after this consultation the other run faster:
select max(date_sale) as data_sale from tbsales, tbsales_tribute where tbsales.emp = tbsales_tribute.emp and tbsales.sale = tbsales_tribute.sale and tbsales.emp = 1 and tbsales_tribute.type = 5
or
select max(date_sale) as data_sale from tbsales key join tbsales_tribute where tbsales.emp = 1 and tbsales_tribute.type = 5
or
select max (date_sale) as data_sale from tbsales join tbsales_tribute on (tbsales_tribute.emp = tbsales.emp and tbsales_tribute.sale = tbsales.sale) where tbsales.emp = 1 and tbsales_tribute.type = 5
Which of these queries is more optimized?
(a friend told me that we should always use the sybase key join instead of join, key join the reserved word always makes the query more optimized, so pe truth? where I can find material about?)
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One should add that v9.0.1 introduced "cache warming", i.e. the server automatically reloads the pages that have been used immediately after the database was started the last time. That may help if the same queries are typically run every time the database is loaded, say, if an according application would usually use the same queries to prefetch data... However, it won't help much in cases where queries are not that homogeneous.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.