On 15 January 2016 at 08:42, [email protected] <[email protected]>
wrote:

> 2016-01-15 2:33 GMT+13:00 Rafael Fialho <[email protected]>:
>> 2016-01-14 9:54 GMT-02:00 [email protected] <[email protected]>:
>> Olá, Ok.. Index criado e mais dados do DDL:
>> Lucas, tente responder abaixo de cada tópico da resposta, e não no topo
>> da mensagem (top-posting).
>> Sua base está com as estatísticas atualizadas? (analyze) Se não está,
>> execute um analyze e verifique, com o explain, se o custo diminuiu ou mudou.
>> O custo presumido pelo plano de execução não chega nem perto da execução
>> real.
>> As funções que você utiliza estão com a volatilidade correta?
>> []'s
>
>
>>
> Olá Rafael.
> Acabei de rodar o ANALYZE nas tabelas à cima mencionadas (Não dá pra fazer
> na DB toda pois levará dias).
>
> Após realização do explain analyze novamente, tudo igual...
> Tenho certeza que é algo na Query.. porém, nào conigo determinar o que.
>
>
> Query original: (Usada antes da criação da TABELA temporária
> (gorfs.nfs_data)
> * Talvez ajude à melhor entender.
>
> SELECT
>>   file.inode_id        AS file_id,
>>   file.parent_inode_id AS file_group,
>>   file.relative_path   AS file_type,
>>   file.file_data       AS file_binary,
>>   file.node_full_path  AS file_name,
>>   file.last_modified   AS date_created
>> FROM
>>   gorfs.nodes AS file
>>   INNER JOIN
>>   gorfs.inode_segments AS iseg ON iseg.st_ino = file.parent_inode_id
>>                                   AND file.object_type = 'S_IFREG'
>>                                   AND iseg.nfs_migration_date IS NULL
>>                                   AND (file.last_modified <
>>                                        (transaction_timestamp() AT TIME
>> ZONE 'UTC' - '1 months' :: INTERVAL))
>>                                   AND iseg.st_ino_target = file.inode_id
>> LIMIT
>>   100;
>
>
> Nova Query (Com a nova tabela: gorfs.nfs_data)
> Preciso que me retorne o mesmo que a de cima, mas mais rápido (A de cima
> também demorava MUITO)
>
>> SELECT
>>   file.inode_id        AS file_id,
>>   file.parent_inode_id AS file_group,
>>   file.relative_path   AS file_type,
>>   file.file_data       AS file_binary,
>>   file.node_full_path  AS file_name,
>>   file.last_modified   AS date_created
>> FROM
>>   gorfs.nodes AS file
>>   INNER JOIN
>>   gorfs.inode_segments AS iseg ON iseg.st_ino = file.parent_inode_id
>>   INNER JOIN
>>   gorfs.nfs_data AS nfs ON file.object_type = 'S_IFREG'
>>                                   AND nfs.migration_date IS NULL
>>                                   AND (file.last_modified <
>>                                        (transaction_timestamp() AT TIME
>> ZONE 'UTC' - '1 months' :: INTERVAL))
>> WHERE file.file_data IS NOT NULL
>> AND nfs.migration.date IS NULL
>> LIMIT
>>   100;
>
>
>
>

** Lembre-se que os IDS são representacões das árvores...*
*Se 1 diretório tem mais de uma coisa, então haverá mais de um ítem com
aquele ID.*

*Tenho que destinguir eles nos campos...*
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a