Re: Slow select query
От | Federico Di Gregorio |
---|---|
Тема | Re: Slow select query |
Дата | |
Msg-id | 533BCC67.7070709@dndg.it обсуждение исходный текст |
Ответ на | Slow select query (Glenn Pierce <glennpierce@gmail.com>) |
Список | psycopg |
On 31/03/2014 22:16, Glenn Pierce wrote: > Hi I have a query that returns a fair amount of data ~ 730000 rows. > In pgadmin The query after multiple runs takes around 5-6 seconds. > > When try to get all the data through psycopg it takes around 20 seconds. > > I have turned of ssl for postgres. > > Does anyone no any reasons why this is ? or is this normal behavior ? psycopg converts text to Python types and even if this is done in C (mostly) it can take time. You have several ways to optimize your query: * grab only the columns you need * if you don't need all the rows, use a server side cursor federico -- Federico Di Gregorio federico.digregorio@dndg.it Di Nunzio & Di Gregorio srl http://dndg.it Credo fermamente che da qualche parte, in una scatola ci sia un gatto che non è vivo ne morto. Credo anche che se i fisici non si sbrigano a dargli una scatoletta, ben presto sarà solo morto. -- adattato da una frase di Sam Black Crow
В списке psycopg по дате отправления: