postgresql - How can I find a null field efficiently using index -


i have query i'm trying find null field millions of records. there 1 or two.

the query looks this:

select  *  “table”  “id” = $1  , “end_time” null   order “start_time” desc limit 1 

how can make query more performant eg using indexes in database.

try partial index, smth like:

create index iname on "table" (id, start_time) end_time null; 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -