| From: | Igor Korot <ikorot01(at)gmail(dot)com> |
|---|---|
| To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
| Cc: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Where the info is stored |
| Date: | 2026-03-01 07:58:37 |
| Message-ID: | CA+FnnTwGjCQFKxZ7Ug5DAScHSznXvGVANwAC9+f6kqWsymLsXQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
It would be interesting to know what to bind ARRAY column
in ODBC code (the type in the SQLBindCol()), but that's a
different topic which is probably OT here.
Thx.
On Sun, Mar 1, 2026 at 1:50 AM Igor Korot <ikorot01(at)gmail(dot)com> wrote:
>
> Hi, David,
>
> On Sat, Feb 28, 2026 at 11:49 PM David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> >
> > On Saturday, February 28, 2026, Igor Korot <ikorot01(at)gmail(dot)com> wrote:
> >>
> >>
> >> draft=# WITH idx AS( SELECT i.indexrelid, i.indrelid, i.indnkeyatts,
> >> i.indkey::int2[] AS indkey FROM pg_index i, pg_class ic, pg_namespace
> >> ns
> >>
> >>
> >> WHERE ic.oid = i.indexrelid AND ns.oid = ic.relnamespace AND
> >> ns.nspname = 'public' AND ic.relname = 'leagues_new' )
> >>
> >>
> >
> > I doubt your index name is leagues_new. That is probably the table name. But ic.relname contains index names.
>
> With some trial and error I think I finally get the query right ;-)
>
> draft=# SELECT c.relname AS name, ixs.tablespace,
> -- Get included columns (PostgreSQL 11+)
> ARRAY(
> SELECT a.attname
> FROM pg_attribute a
> WHERE a.attrelid = idx.indrelid
> AND a.attnum = ANY(idx.indkey)
> AND a.attnum > 0
> ORDER BY array_position(idx.indkey, a.attnum)
> OFFSET idx.indnkeyatts
> ) AS included,
> c.reloptions AS storage
> FROM pg_index idx, pg_class c, pg_namespace n, pg_class t, pg_indexes ixs
> WHERE ixs.indexname = c.relname AND c.oid = idx.indexrelid AND t.oid =
> idx.indrelid AND n.oid = c.relnamespace AND idx.indisprimary AND
> n.nspname = 'public' AND t.relname = 'leagues_new';
> name | tablespace | included | storage
> ------------------+------------+-------------------------+-----------------
> leagues_new_pkey | | {drafttype,scoringtype} | {fillfactor=50}
> (1 row)
>
> draft=#
>
> Thank you for sticking with me and sorry for the trouble.
>
> I am getting everything in one DB hit and the query is not that big.
>
> I am only worrying about tablespace filtering but I think I got it
> right.
>
> Thx once again.
>
> P.S.: If you see any improvement - please by all means do let me know.
>
>
> >
> > David J.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2026-03-01 10:33:00 | Re: Where the info is stored |
| Previous Message | Igor Korot | 2026-03-01 07:50:52 | Re: Where the info is stored |