</code>
http://www.webster.com/cgi-bin/dictionary?sourceid=Mozilla-search&va=placebo
the only time I've seen "1=1" used is when you are building a dynamic sql statement, sort of like this:
http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1288401763279 <code>
but it goes on the "front" of the where clause and is there solely to let you just add "and <condition>" instead of figuring out whether to add "where <condition>" or "and <condition>"
Have you ever observed it "improve" performance. I can think of reasons "it would", but not because you added 1=1. But because you "added anything and caused a hard parse"
for example:
ops$tkyte@ORA9IR2> create table t
2 as
3 select 99 id, all_objects.*
4 from all_objects;
Table created.
ops$tkyte@ORA9IR2> update t set id = 1 where rownum = 1;
1 row updated.
ops$tkyte@ORA9IR2> create index t_idx on t(id);
Index created.
ops$tkyte@ORA9IR2> exec dbms_stats.gather_table_stats( user, 'T', method_opt => 'for all indexed columns', cascade=>true );
PL/SQL procedure successfully completed.
ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> variable n number
ops$tkyte@ORA9IR2> exec :n := 99;
PL/SQL procedure successfully completed.
ops$tkyte@ORA9IR2> set autotrace traceonly statistics
ops$tkyte@ORA9IR2> select * from t where id = :n;
28410 rows selected.
Statistics
----------------------------------------------------------
2293 consistent gets
..
28410 rows processed
ops$tkyte@ORA9IR2> set autotrace off
ops$tkyte@ORA9IR2> exec :n := 1;
PL/SQL procedure successfully completed.
ops$tkyte@ORA9IR2> set autotrace traceonly statistics
ops$tkyte@ORA9IR2> select * from t where id = :n;
1 row selected.
Statistics
----------------------------------------------------------
406 consistent gets
...
1 rows processed
that is alot of work for a single row!!! 406 IO's... let's add 1=1: ops$tkyte@ORA9IR2> select * from t where id = :n AND 1=1;
1 row selected.
Statistics
----------------------------------------------------------
4 consistent gets
...
1 rows processed
much better, and it is definitely better than without: ops$tkyte@ORA9IR2> select * from t where id = :n;
1 row selected.
Statistics
----------------------------------------------------------
406 consistent gets
...
1 rows processed
ops$tkyte@ORA9IR2> select * from t where id = :n AND 1=1;
1 row selected.
Statistics
----------------------------------------------------------
4 consistent gets
...
1 rows processed
but, was it 1=1 or - something else? It was something else: ops$tkyte@ORA9IR2> select * from t hard_parse_me where id = :n;
1 row selected.
Statistics
----------------------------------------------------------
4 consistent gets
...
1 rows processed
ops$tkyte@ORA9IR2> set autotrace off
It was bind variable peeking in this case