Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

postgresql select where is null takes too long

Status
Not open for further replies.

sergiui

Programmer
Feb 15, 2008
2
RO
Hi,

I have a TABLE with many rows (about 1000 000) I want to get all the fields that have the value on colum A null.
Field A is integere and is indexed with a default btree.

My query is:
"SELECT * FROM table WHERE A is null"

this takes forever and eventualy returns nothing even if i do a simple "SELECT * FROM table LIMIT 1000" i can see that a have null values on the colum.

I think that null values are not indexed in postgresql or the index is not use properly.
Does anyone have an ideea?

Thank You!
 
Found the solution, i had to many nulls 90%, you may delete the post sry...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top