Re: [GENERAL] how to optimize my c-extension functions

2005-01-10 Thread Pierre-Frédéric Caillaud
That's not what I meant... I meant, what does 'c1c1C(=O)N' means ? If the search operation is too slow, you can narrow it using standard postgres tools and then hand it down to your C functions. Let me explain, I have no clue about this 'c1c1C(=O)N' syntax, but I'll suppose you

Re: [GENERAL] how to optimize my c-extension functions

2005-01-10 Thread TJ O'Donnell
I was not hoping that indexing, per se, would help me. In fact, indexing smiles would be of virtually no use to me, except for exact matches, e.g. where smiles = 'CCCOC'; I was only trying to subvert the use of indexing for my own purposes, to store the parsed smiles somewhere automatic for the sql

Re: [GENERAL] how to optimize my c-extension functions

2005-01-09 Thread Tom Lane
"TJ O'Donnell" <[EMAIL PROTECTED]> writes: > The only type of search will be of the type: > Select smiles,id from structure where oe_matches(smiles,'c1c1C(=O)N'); You haven't really said much about how you expect an index to be able to help you with this, but I think if any index type can he

Re: [GENERAL] how to optimize my c-extension functions

2005-01-09 Thread TJ O'Donnell
Let me first say that I will routinely be dealing with one million+ rows, so I want to take care to optimize my work as much as possible, and to consider carefully my design decisions. The only type of search will be of the type: Select smiles,id from structure where oe_matches(smiles,'c1c1C(=

Re: [GENERAL] how to optimize my c-extension functions

2005-01-09 Thread Pierre-Frédéric Caillaud
Well, first and easy thing you can do is create a column to store the parsed representation and update it via a trigger when the original, unparsed column is updated or inserted. Is this sufficiently "hidden from the user" for you ? I know it's not really hidden, but the fact that updating

Re: [GENERAL] how to optimize my c-extension functions

2005-01-09 Thread TJ O'Donnell
To add to my last followup posting, the only way I use oe_mathces(smiles) is in something like the following: Select smiles,id from structure where oe_matches(smiles,'CCOC'); The match string 'CCOC' in this case, varies widely according to the needs of the user during that session. It is analogous

Re: [GENERAL] how to optimize my c-extension functions

2005-01-09 Thread TJ O'Donnell
Yes, my c function and it's sql counterpart, oe_matches(smiles) uses two steps (1) parse smiles (2) search parsed smiles. Parsing is expensive. The smiles has an external string representation, which is stored in a smiles column, but only the parsed form is actually searchable. The smiles represe

Re: [GENERAL] how to optimize my c-extension functions

2005-01-08 Thread Pierre-Frédéric Caillaud
I gather your program uses two steps, let's call them : - parse( smiles ) -> data - search( data ) -> result You can create a functional index on your smiles column, but I don't know if this will help you ; you can do things like CREATE INDEX ... ON mytable( lower( myfi

[GENERAL] how to optimize my c-extension functions

2005-01-08 Thread TJ O'Donnell
I've written a c-language extension to postgresql to implement a chemical search of a varchar column (named smiles, typically). It might be called as: oe_matches(smiles,'COCC') where 'COCC' is a typical search string. This uses 3rd party functions to parse the varchar inputs into c++ objects. I