Re: [PATCH] postgres_fdw extension support

Поиск
Список
Период
Сортировка
От Paul Ramsey
Тема Re: [PATCH] postgres_fdw extension support
Дата
Msg-id CACowWR1nqFZRkr81JNBHh3qaJgUXGVgvRGcdEhmUMT5fJqRa2g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] postgres_fdw extension support  (Andres Freund <andres@anarazel.de>)
Ответы Re: [PATCH] postgres_fdw extension support  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Tue, Jul 21, 2015 at 7:45 AM, Andres Freund <andres@anarazel.de> wrote:

>> +
>> +     /* We need this relation to scan */
>> +     depRel = heap_open(DependRelationId, RowExclusiveLock);
>> +
>> +     /* Scan the system dependency table for a all entries this operator */
>> +     /* depends on, then iterate through and see if one of them */
>> +     /* is a registered extension */
>> +     ScanKeyInit(&key[0],
>> +                             Anum_pg_depend_objid,
>> +                             BTEqualStrategyNumber, F_OIDEQ,
>> +                             ObjectIdGetDatum(procnumber));
>> +
>> +     scan = systable_beginscan(depRel, DependDependerIndexId, true,
>> +                                                       GetCatalogSnapshot(depRel->rd_id), nkeys, key);
>> +
>> +     while (HeapTupleIsValid(tup = systable_getnext(scan)))
>> +     {
>> +             Form_pg_depend foundDep = (Form_pg_depend) GETSTRUCT(tup);
>> +
>> +             if ( foundDep->deptype == DEPENDENCY_EXTENSION )
>> +             {
>> +                     List *extlist = fpinfo->extensions;
>> +                     ListCell *ext;
>> +
>> +                     foreach(ext, extlist)
>> +                     {
>> +                             Oid extension_oid = (Oid) lfirst(ext);
>> +                             if ( foundDep->refobjid == extension_oid )
>> +                             {
>> +                                     nresults++;
>> +                             }
>> +                     }
>> +             }
>> +             if ( nresults > 0 ) break;
>> +     }
>> +
>> +     systable_endscan(scan);
>> +     relation_close(depRel, RowExclusiveLock);
>> +
>> +     return nresults > 0;
>> +}
>
> Phew. That's mighty expensive to do at frequency.
>
> I guess it'll be more practical to expand this list once and then do a
> binary search on the result for the individual functions

So, right after reading the options in postgresGetForeignRelSize,
expand the extension list into a list of all ops/functions, in a
sorted list, and let that carry through to the deparsing instead? That
would happen once per query, right? But the deparsing also happens
once per query too, yes? Is the difference going to be that big? (I
speak not knowing the overhead of things like systable_beginscan, etc)

Thanks!

P



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bjorn Munch
Дата:
Сообщение: Re: Solaris testers wanted for strxfrm() behavior
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: PL/pgSQL, RAISE and error context