2010年12月30日星期四

[fw-db] Zend_Db and Postgres sequence - lots of queries

Hi,

I'm using as DB Postgres, just becouse I work every day with Oracle, I
worked with MySql, and so I just want start using a new DB.
I saw using Zend_Db_Profiler_Firebug that Zend does a lot of queries just to
know the sequenceid, I guess.
After I do a select query, I saw query like this:


SELECT a.attnum, n.nspname, c.relname, a.attname AS colname, t.typname AS
type, a.atttypmod,
FORMAT_TYPE(a.atttypid, a.atttypmod) AS complete_type, d.adsrc AS
default_value, a.attnotnull AS notnull, a.attlen AS length,
co.contype, ARRAY_TO_STRING(co.conkey, ',') AS conkey FROM pg_attribute AS a
JOIN pg_class AS c ON a.attrelid = c.oid
JOIN pg_namespace AS n ON c.relnamespace = n.oid JOIN pg_type AS t ON
a.atttypid = t.oid LEFT OUTER JOIN pg_constraint
AS co ON (co.conrelid = c.oid AND a.attnum = ANY(co.conkey) AND co.contype =
'p') LEFT OUTER JOIN pg_attrdef AS d ON
d.adrelid = c.oid AND d.adnum = a.attnum WHERE a.attnum > 0 AND c.relname =
'TABLE_NAME' ORDER BY a.attnum


I thought that this could become to be a big problem. For example if I got
about 200 hundred queries more than half are queries like that one.

Is it normal? Is there a way to limit these queries? I'm making some mistake
or what? I have never work with Zend and other DB, so I don't know if it is
so with them too. But maybe it's becouse of the use of sequence instead of
auto-increment columns.

Thanks in advice,
Vincenzo
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Db-and-Postgres-sequence-lots-of-queries-tp3168142p3168142.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: