Subject | not null and index usage |
---|---|
Author | Sergio H. Gonzalez |
Post date | 2012-02-13T22:09:06Z |
Hello! Having this simple query: (and "some_id" being a foreing key)
select * from my_table where (some_id is null)
uses the index... but
select * from my_table where (some_id is not null)
doesn't uses it.
Now the table is quite small, so I have no performance issues, but can I
do something for the future? Is the any better way of having all records
with not null IDs?
Thanks!
-sergio
[Non-text portions of this message have been removed]
select * from my_table where (some_id is null)
uses the index... but
select * from my_table where (some_id is not null)
doesn't uses it.
Now the table is quite small, so I have no performance issues, but can I
do something for the future? Is the any better way of having all records
with not null IDs?
Thanks!
-sergio
[Non-text portions of this message have been removed]