Check the Oracle

*、select 1 from table where.....

The syntax is similar to select * from table where.....
But in terms of efficiency: 1 > table_col > *, because there is no need to query the data dictionary
The total number of query data: sum(1) is equivalent to sum(*), but the actual operating efficiency remains to be verified~

 

*. There will be such a demand in many times: the time and space information should be ranked in the reverse order of paging query, but the mechanism of oracle is that null is the largest, so:

The solution is: since null is the largest, then set the null value to a default minimum value when sorting, tools such as case when variable then result 1 else result 2 end (this method can also be used with hibernate-hql)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326520594&siteId=291194637