Re: [HACKERS] Terrible performance on wide selects

2003-02-14 Thread Bruce Momjian
Added to TODO: * Cache last known per-tuple offsets to speed long tuple access --- Tom Lane wrote: > Hannu Krosing <[EMAIL PROTECTED]> writes: > >> i.e. for tuple with 100 cols, allocate an array of 100 pointers, p

Re: [HACKERS] Terrible performance on wide selects

2003-01-23 Thread Hannu Krosing
Dann Corbit kirjutas N, 23.01.2003 kell 02:22: > [snip] > > So (for instance) if you have 12 variable fields, you would > > store 12 integers at the start of the record. > > Additionally, you could implicitly size the integers from the properties > of the column. A varchar(255) would only need a

Re: [HACKERS] Terrible performance on wide selects

2003-01-23 Thread Tom Lane
Daniel Kalchev <[EMAIL PROTECTED]> writes: > Does this mean, that constructing tables where fixed length fields are > 'before' variable lenght fields and 'possibly null' fields might increase > performance? There'd have to be no nulls, period, to get any useful performance difference --- but yes

Re: [HACKERS] Terrible performance on wide selects

2003-01-23 Thread Tom Lane
Hannu Krosing <[EMAIL PROTECTED]> writes: >> i.e. for tuple with 100 cols, allocate an array of 100 pointers, plus >> keep count of how many are actually valid, > Additionally, this should also make repeted determining of NULL fields > faster - just put a NULL-pointer in and voila - no more bit-sh

Re: [HACKERS] Terrible performance on wide selects

2003-01-23 Thread Daniel Kalchev
>>>Hannu Krosing said: > Tom Lane kirjutas N, 23.01.2003 kell 02:04: > > We already do cache column offsets when they are fixed. The code that's > > the problem executes when there's a variable-width column in the table > > --- which means that all columns to its right are not at fixed offsets

Re: [HACKERS] Terrible performance on wide selects

2003-01-23 Thread Hannu Krosing
Hannu Krosing kirjutas N, 23.01.2003 kell 12:11: > make the pointer array incrementally for O(N) performance: > > i.e. for tuple with 100 cols, allocate an array of 100 pointers, plus > keep count of how many are actually valid, Additionally, this should also make repeted determining of NULL fie

Re: [HACKERS] Terrible performance on wide selects

2003-01-23 Thread Hannu Krosing
Tom Lane kirjutas N, 23.01.2003 kell 02:04: > "Dann Corbit" <[EMAIL PROTECTED]> writes: > > Maybe I don't really understand the problem, but it seems simple enough > > to do it once for the whole query. > > We already do cache column offsets when they are fixed. The code that's > the problem exec

Re: [HACKERS] Terrible performance on wide selects

2003-01-23 Thread Hannu Krosing
Tom Lane kirjutas N, 23.01.2003 kell 02:18: > "Dann Corbit" <[EMAIL PROTECTED]> writes: > > Why not waste a bit of memory and make the row buffer the maximum > > possible length? > > E.g. for varchar(2000) allocate 2000 characters + size element and point > > to the start of that thing. > > Surely

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Dann Corbit
[snip] > For the disk case, why not have the start of the record > contain an array of offsets to the start of the data for each > column? It would only be necessary to have a list for > variable fields. > > So (for instance) if you have 12 variable fields, you would > store 12 integers at th

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Tom Lane
"Dann Corbit" <[EMAIL PROTECTED]> writes: > For the disk case, why not have the start of the record contain an array > of offsets to the start of the data for each column? It would only be > necessary to have a list for variable fields. No, you'd need an entry for *every* column (or at least, eve

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Dann Corbit
[snip] > So (for instance) if you have 12 variable fields, you would > store 12 integers at the start of the record. Additionally, you could implicitly size the integers from the properties of the column. A varchar(255) would only need an unsigned char to store the offset, but a varchar(8) w

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Dann Corbit
> -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 22, 2003 4:18 PM > To: Dann Corbit > Cc: Steve Crawford; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Subject: Re: [HACKERS] Terrible performance on wide selects > &g

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Tom Lane
"Dann Corbit" <[EMAIL PROTECTED]> writes: > Why not waste a bit of memory and make the row buffer the maximum > possible length? > E.g. for varchar(2000) allocate 2000 characters + size element and point > to the start of that thing. Surely you're not proposing that we store data on disk that way.

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Dann Corbit
> -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 22, 2003 4:04 PM > To: Dann Corbit > Cc: Steve Crawford; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Subject: Re: [HACKERS] Terrible performance on wide selects > &g

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Tom Lane
"Dann Corbit" <[EMAIL PROTECTED]> writes: > Maybe I don't really understand the problem, but it seems simple enough > to do it once for the whole query. We already do cache column offsets when they are fixed. The code that's the problem executes when there's a variable-width column in the table -

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Dann Corbit
> -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 22, 2003 3:15 PM > To: Steve Crawford > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [HACKERS] Terrible performance on wide selects > > > Steve Crawford sen

Re: [HACKERS] Terrible performance on wide selects

2003-01-22 Thread Tom Lane
Steve Crawford sent me some profiling results for queries involving wide tuples (hundreds of columns). > Done, results attached. nocachegetattr seems to be the likely suspect. Yipes, you can say that again. % cumulative self self total time seconds seconds