The actual SQL time is 1.04 second for this ORM-inspired query:

SELECT entries.category AS entries_category, entries.title AS
entries_title, entries.thumb200 AS entries_thumb200, entries.creator
AS entries_creator, entries.doctype AS entries_doctype,
entries.filename AS entries_filename, entries.content AS
entries_content, entries.entry_id AS entries_entry_id,
entries.entry_date AS entries_entry_date, entries.is_public AS
entries_is_public, entries.size AS entries_size, entries.orr_id AS
entries_orr_id FROM (SELECT `Entry`.entry_id AS entry_id,
`Entry`.orr_id AS orr_id, `Entry`.entry_date AS entry_date,
`Entry`.creator AS creator, `Entry`.title AS title, `Entry`.category
AS category, `Entry`.content AS content, `Entry`.filename AS filename,
`Entry`.thumb200 AS thumb200, `Entry`.doctype AS doctype, `Entry`.size
AS size, `Entry`.is_public AS is_public FROM `Entry` WHERE
`Entry`.is_public) AS entries WHERE entries.orr_id = 6153 and
entries.category in (1, 2, 3, 4, 6, 7, 8, 9, 10, 11);

vs 0.14 seconds for this non-ORM one:

SELECT `Entry`.entry_id, `Entry`.orr_id, `Entry`.category,
`Entry`.title, `Entry`.entry_date, `Entry`.filename, `Entry`.thumb200
FROM `Entry` WHERE (`Entry`.is_public AND `Entry`.orr_id = 6153)  AND
`Entry`.category IN (1,2,3,4,5,6,7,8,9,10,11) order by
`Entry`.entry_date DESC LIMIT 11;

vs 0.13 seconds for my manual equivalent:

select entry_id, orr_id, category, title, entry_date, filename,
thumb200 from Entry where is_public and orr_id = 6153 and category in
(1,2,3,4,5,6,7,8,9,10,11) order by entry_date desc limit 11;


vs 0.07 seconds for the same with *:

select * from Entry where is_public and orr_id=6153 and category in
(1,2,3,4,6,7,8,9,10,11);

I'm tempted to say ORM is good but not when based on a select, at
least not with this particular dataset.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to