Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Adrian Klaver
On 8/14/21 4:05 PM, Gavan Schneider wrote: On 15 Aug 2021, at 7:47, Bret Stern wrote: I will say this business has been behind in the attributes game. Plus there are many "artsy" vendors who can hardly speak in these terms, and don't publish to us, so we do the best we can. Getting

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Gavan Schneider
On 15 Aug 2021, at 7:47, Bret Stern wrote: > I will say this business has been behind in the attributes game. Plus there > are many "artsy" vendors who can hardly speak in these terms, and don't > publish to us, so we do the best we can. > > Getting vendors to supply the basic values is a

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Adrian Klaver
On 8/14/21 2:47 PM, Bret Stern wrote: On 8/14/2021 2:13 PM, Adrian Klaver wrote: On 8/14/21 2:04 PM, Bret Stern wrote: Vendors supply dimensions, depending on where in the world the product comes from, could be metric, imperial or fraction Yes, nominal dimensions. That is what I'm

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Bret Stern
On 8/14/2021 2:13 PM, Adrian Klaver wrote: On 8/14/21 2:04 PM, Bret Stern wrote: Yep, I provide the UI for the user to select the vendor supplied unit value from the list. I should have been more specific, does the vendor do all the conversions and supply them to you? Vendors supply

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Adrian Klaver
On 8/14/21 2:04 PM, Bret Stern wrote: Yep, I provide the UI for the user to select the vendor supplied unit value from the list. I should have been more specific, does the vendor do all the conversions and supply them to you? I don't want anyone entering (manually) any value, they must

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Bret Stern
Yep, I provide the UI for the user to select the vendor supplied unit value from the list. I don't want anyone entering (manually) any value, they must select from my list (fed from a PG table). (and since some units don't translate exactly, they pick the one that is closest). It's Tile

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Adrian Klaver
On 8/14/21 1:24 PM, Bret Stern wrote: Here's the clip of the UI. The user selects whatever value the vendor provides for unit thickness. The data entry So the vendors supply the measurements in all the various units for a given item? people aren't comfortable converting. At this point

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Guyren Howe
You might define new types for temperature, length, whatever, with suitable conversion, operation and creation functions. You’d be able to define how the new types participate in indexes, support directly sorting on them, so you package up this complexity and forget about it. Either normalize

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Gogala, Mladen
I would write a stable function converting everything to metric (or imperial, depends on your preferences) and sort on the return of the function. Since unit conversion functions do not need to modify the database and should always return the same values for the same arguments, the function

Re: Understaning postgresql instance vs database

2021-08-14 Thread Adrian Klaver
On 8/14/21 10:34 AM, Open _ wrote: Like what in PostgreSQL's statistics collector is an instance statistic verses a database statistic. I found a pgtop utility but it seems to require a database parameter So are all stats database specific? or is the top info instance stats and the list

Understaning postgresql instance vs database

2021-08-14 Thread Open _
In Informix, the instance is everything.   Buffer pools, transaction logging, backup and restores and all monitoring is done at the instance level databases are just logical collections of tables in an instance. In DB2 there is some instance configuration, but most everything is at the database

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread bret_st...@machinemanagement.com
Of course it's a complete disorganized mess..That'a the world I live in.Best thing is, I'm walking away with some new strategies.You guys rock Original message From: Sándor Daku Date: 8/14/21 10:19 AM (GMT-08:00) To: Tom Lane Cc: Adrian Klaver , Bret Stern ,

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Adrian Klaver
On 8/14/21 10:19 AM, Sándor Daku wrote: I'm not sure, but maybe a kind of cast function that cast everything into a reasonable common unit(Khm... millimeters) and sort on that? It seems relatively simple to pick up the value and unit from a string with a regexp. Admittedly the data would

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Sándor Daku
On Sat, 14 Aug 2021 at 19:03, Tom Lane wrote: > Adrian Klaver writes: > > On 8/14/21 9:37 AM, Bret Stern wrote: > >> I haven't explored doing this with numeric types, but some columns > >> needed alpha chars eg 13mm. > > > Two columns: > > > data_val(numeric) data_unit(varchar) > > 13

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Tom Lane
Adrian Klaver writes: > On 8/14/21 9:37 AM, Bret Stern wrote: >> I haven't explored doing this with numeric types, but some columns >> needed alpha chars eg 13mm. > Two columns: > data_val(numeric) data_unit(varchar) > 13mm It sounds like your data is a completely

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Bret Stern
I like that idea On 8/14/2021 9:46 AM, Adrian Klaver wrote: On 8/14/21 9:37 AM, Bret Stern wrote: Strings; I haven't explored doing this with numeric types, but some columns needed alpha chars eg 13mm. Two columns: data_val(numeric)    data_unit(varchar) 13    mm Although I

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Adrian Klaver
On 8/14/21 9:37 AM, Bret Stern wrote: Strings; I haven't explored doing this with numeric types, but some columns needed alpha chars eg 13mm. Two columns: data_val(numeric) data_unit(varchar) 13 mm Although I could have front ended this UI with mm nomenclature

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Bret Stern
Strings; I haven't explored doing this with numeric types, but some columns needed alpha chars eg 13mm. Although I could have front ended this UI with mm nomenclature I did not. I'll put a table together with appropriate numeric types and see if the sort will behave. On 8/14/2021 9:21

Join for the parent table will not leverage the index scan

2021-08-14 Thread Shrikant Bhende
We have two tables, both have ~36 partitions. This is my first query, which attempts to join the parent tables on the columns that have been used to create multi-column indexes for all partitions (multi-column indexes defined on session_id, detail_id in that order): *PostgreSQL version : 10*--

Re: Sort question - Fractions, Metric etc

2021-08-14 Thread Adrian Klaver
On 8/14/21 9:14 AM, Bret Stern wrote: I have a table with metric, imperial, fraction columns. Is there a way to sort correctly using imperial (eg; .125, .375, .437 -> 1., 1.125) Alright how is this different from metric or fraction? I can sort of see fraction if you mean as 1/3, 1/20, etc.

Sort question - Fractions, Metric etc

2021-08-14 Thread Bret Stern
I have a table with metric, imperial, fraction columns. Is there a way to sort correctly using imperial (eg; .125, .375, .437 -> 1., 1.125) Couldn't handle it with ORDER BY ASC, DESC args so I added a sort_column and sorted based on those values eg; 1,2,3,4,5,6 indicating the value I need