Here are the queries which were killing the Today American Database and how I fixed them:
(1) Query 1
--3 secs
select * from rssfeedcontents
where ContentId IN
(Select TOP 50 ContentId from UserRssFeedStatus
Where UserId=4 And [Read] = 0
order by ContentId desc)
order by PublishDate desc, ContentId desc
---1 secs
SELECT RFC1.* FROM rssfeedcontents RFC1
INNER JOIN (SELECT TOP 50 ContentId FROM UserRssFeedStatus
WHERE UserId=4 And [Read] = 0
ORDER BY ContentId DESC) RFC2 ON (RFC1.ContentId = RFC2.ContentId)
ORDER BY PublishDate DESC, ContentId DESC
-- 0 secs
SELECT TOP 50 RFC1.* FROM rssfeedcontents RFC1
INNER JOIN UserRssFeedStatus URFS ON (UserId=4 And [Read] = 0 AND RFC1.ContentId = URFS.ContentId)
ORDER BY URFS.ContentId DESC, RFC1.PublishDate DESC
(2) Query 2
--13 secs
select TOP 250 4, ContentId, 0, GETDATE() from rssfeedcontents
where ContentId NOT IN (Select ContentId from UserRssFeedStatus Where UserId=4 And [Read] = 1)
order by PublishDate desc, ContentId desc
--9 secs
SELECT TOP 250 4, RFC.ContentId, 0, GETDATE() FROM rssfeedcontents RFC
LEFT OUTER JOIN (SELECT ContentId FROM UserRssFeedStatus
WHERE UserId=4 And [Read] = 1) URFS ON (URFS.ContentId = RFC.ContentId)
WHERE URFS.ContentId IS NULL
ORDER BY ContentId DESC, PublishDate DESC
--6 secs
SELECT TOP 250 4, RFC.ContentId, 0, GETDATE() FROM rssfeedcontents RFC
LEFT JOIN UserRssFeedStatus URFS ON
(UserId=4 And [Read] = 1 AND URFS.ContentId = RFC.ContentId)
WHERE URFS.ContentId IS NULL
ORDER BY ContentId DESC, PublishDate DESC
(3) Query 3
--3 secs
select * from RssFeedContents
Where ItemTitle IN
(select ItemTitle from DuplicateItems
where itemcount > 1)
AND Contentid NOT IN
(Select DISTINCT ContentId from UserReadRssFeedContents)
--2 secs
select * from RssFeedContents RFC
INNER JOIN DuplicateItems DI ON (RFC.ItemTitle = DI.ItemTitle AND DI.ItemCount > 1)
LEFT JOIN (Select DISTINCT ContentId from UserReadRssFeedContents) URFS
ON (RFC.ContentId = URFS.ContentId)
WHERE URFS.ContentId IS NULL
This blog includes some personal comments along with all the details about what is happening in the today american world. Come here to read some interesting tech tips and get insider information and updates about our service.
Wednesday, July 28, 2010
Sunday, July 25, 2010
Today American operational once again
I have been increasingly frustrated by the lack of an alternate to today american. So after a log time, i revisited the code & implemented some fixes which make the site useable again.
Users are welcome to start using the site while i am testing and fixing issues as i find them.
Published with Blogger-droid v1.4.8
Monday, May 17, 2010
Deleting windows.old folder after windows upgrade
The best option is:
http://www.sevenforums.com/tutorials/19151-windows-old-folder-delete.html
http://www.sevenforums.com/tutorials/19151-windows-old-folder-delete.html
Sunday, February 28, 2010
Orb.com is cool...
They have been working on this for quite sometime. It works really well these days, atleast as a streaming solution.
- Posted using BlogPress from my iPhone
- Posted using BlogPress from my iPhone
Tuesday, February 16, 2010
Windows 7 taskbar becomes invisible
This can happen after the screensaver runs. To fix this, run screensaver again and exit from it.
- Posted using BlogPress from my iPhone
- Posted using BlogPress from my iPhone
Today American domain expired on me!
But now it is back up again.
- Posted using BlogPress from my iPhone
- Posted using BlogPress from my iPhone
Wednesday, February 3, 2010
Indian websites are weird...
They are all heavy, slow loading pages which take forever to load on the lousy Internet connections!
The worst site I have seen so far (even in terms of content) is the Toyota Indian website. It is a disgrace considering their cars are relatively expensive.
- Posted using BlogPress from my iPhone
The worst site I have seen so far (even in terms of content) is the Toyota Indian website. It is a disgrace considering their cars are relatively expensive.
- Posted using BlogPress from my iPhone
Subscribe to:
Posts (Atom)