lindner (lindner) wrote,

And you thought your SQL sucked..

Go on over to the New York Times home page and view source. Drop your jaw at the HTML comments that reveal their gnarly SQL they use to generate their home page.

Each three article section has the SQL used to generate it in a comment above it. The funny thing is that the SQL is longer than the results.

  select oid 
    from assetrelationtree
   where otype='NYT_Article' and nparentid in 
         (select nid from assetrelationtree where nparentid=0 and oid in
            (select id from collection where id in 
              (select distinct oid from assetrelationtree 
                where nparentid=(select nid from assetrelationtree 
                                  where oid=1004547 and nparentid=0) and
                                        otype='Collection') and 
                                    subtype='NYT_Article')) and 
                      ncode <= '20060407' and 
                      oid not in (1125004343548,1125004284421,1125004335857,
     order by ncode DESC,nrank ASC

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment