MAX always process all rows - use order by and limit - so query will look this way SELECT * FROM wbsites WHERE url = '...' ORDER BY id DESC LIMIT 1 For this case subquery is not required EDIT: Forgot where url.
– SergeS Jun 14 at 17:13 Binary Tree.... – gAMBOOKa Jun 14 at 17:14 and what will happen if you put .. FROM websites USE INDEX(PRIMARY) ..( or USE INDEX(id) - I don't remember correct syntax now ) – SergeS Jun 14 at 17:22 another idea is to create combined index ( url, id ) - it could help – SergeS Jun 14 at 17:24.
Consider alter table websites add index a (url, active); select active from websites where url = 'google. Com' order by id desc limit 1.
The query is good, though additional index with active is not needed, this column is used only in select. – piotrm Jun 14 at 17:59 shouldn't active column in the index will promote the query to "uses index", though? – memnoch_proxy Jun 14 at 18:17 Index on url alone would be enough for that, at least if where condition is selective enough.
But if most rows have 'google. Com' then it would be better to use just PRIMARY index to find rows in descending id order and check their url. – piotrm Jun 14 at 18:33.
MAX always process all rows - use order by and limit - so query will look this way.
For example, if you want to select the name of each department along with the name of its manager, you can write the query in one of two ways. In the first example which follows, the hint /++ordered++/ says to do the join in the order the tables appear in the FROM clause with attempting to optimize the join order. Suppose that there are 10 departments and 1000 employees, and that the inner table in each query has an index on the join column.
In the first query, the first table produces 10 qualifying rows (in this case, the whole table). In the second query, the first table produces 1000 qualifying rows. The first query will access the EMP table 10 times and scan the DEPT table once.
The second query will scan the EMP table once but will access the DEPT table 1000 times. Therefore the first query will perform much better. As a rule of thumb, tables should be arranged from smallest effective number rows to largest effective number of rows.
The effective row size of a table in a query is obtained by applying the logical conditions that are resolved entirely on that table. In another example, consider a query to retrieve the social security numbers and names of employees in a given location, such as New York. According to the sample schema, the query would have three table references in the FROM clause.
The three tables could be ordered in six different ways. Although the result is the same regardless of which order you choose, the performance could be quite different.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.