Hi, we have table having 23 million rows. This is the table structure. Table Request:
Column | Type | Modifiers -----------+-----------------------------+----------- origindb | character(1) | not null uid | integer | not null rtype | integer | senderid | integer | destaddr | character varying(15) | opid | integer | devmodel | integer | ikind | integer | itemid | character varying(10) | tranfk | integer | enteredon | timestamp without time zone | status | integer | accountid | integer | Indexes: "request_pkey" primary key, btree (origindb, uid) I do max Query like this select max(uid) from request where originDB=1; it took around 20 min to return the result.. Since max, count functions do the full table scan, i tried the workaround given.. select uid from request where originDB=1 order by uid desc limit 1; this query runs forever.. i tried even without where condition..no result.. I'm not able to figure out what could be the reason.. can anybody help? Thanks in Advance Regards Priya __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/ ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly