473,652 Members | 3,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Indexes to Functions

Hi,

I have a table, where one of the columns "extradata" is a gob of XML.
I'd like to be able to create an index on this function.. so i tried
this
CREATE INDEX actitemsXML_idx ON act_items
(pgxml_xpath(ex tradata,'//RequestInfo/refund_id/text()','','')) ;

And i got this nice little error

ERROR: parser: parse error at or near
"'//RequestInfo/refund_id/text()'" at character 66

I tried escaping the single quotes.. that basically leaves me at a psql
prompt with a ', meaning i need to close my quote, but they're all
escaped.

If anyone has any input for adding index's on functions that have single
quotes in them, that would be great.

Thanks.

Jeff.
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #1
2 1350
On Mon, Oct 06, 2003 at 11:15:06 -0300,
Jeff MacDonald <in**@bignose.c a> wrote:
Hi,

I have a table, where one of the columns "extradata" is a gob of XML.
I'd like to be able to create an index on this function.. so i tried
this
CREATE INDEX actitemsXML_idx ON act_items
(pgxml_xpath(ex tradata,'//RequestInfo/refund_id/text()','','')) ;


I don't think that you can create indexes on functions that had expressions
or constants for parameter values in 7.3 and earlier. You might want to
try this with the 7.4 beta and see if it works there. There will probably
be a 7.4 release candidate this week, so you may be able to consider
7.4 for production soon.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #2

On Mon, 6 Oct 2003, Jeff MacDonald wrote:
I have a table, where one of the columns "extradata" is a gob of XML.
I'd like to be able to create an index on this function.. so i tried
this

CREATE INDEX actitemsXML_idx ON act_items
(pgxml_xpath(ex tradata,'//RequestInfo/refund_id/text()','','')) ;

And i got this nice little error

ERROR: parser: parse error at or near
"'//RequestInfo/refund_id/text()'" at character 66

I tried escaping the single quotes.. that basically leaves me at a psql
prompt with a ', meaning i need to close my quote, but they're all
escaped.

If anyone has any input for adding index's on functions that have single
quotes in them, that would be great.


In 7.3 (and earlier), functional indexes must be defined on a function
over columns in the table. You cannot put fixed parameters in the call.
You can generally hack around this by making a function on only the
columns that calls the function with the constant arguments.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4961
by: Chris | last post by:
Any help would be appreciated. I am running a script that does the following in succession. 1-Drop existing database and create new database 2-Defines tables, stored procedures and functions in the database 3-Imports data using bulk insert 4-Analyzes data using stored procedures I would like to improve the performance of the analysis in step 4 by
1
3105
by: Zack Sessions | last post by:
Still using SQL7. I am wondering how come there is not an Information_Schema view that lists indexes? Information_Schema is supposed to be the safest way to obtain information on metadata, but it appears that the only way to get a list of indexes is with a system stored proc.
2
14482
by: Jennifer | last post by:
I've got a table with 36+ million rows. I've been asked to modify the table and add in an identity column. The code I used caused SQL to lock up and it maxed out the log files. :) The code I used is: Begin Transaction Alter Table ODS_DAILY_SALES_POS ADD ODS_DAILY_SALES_POS_ID BigInt NOT NULL IDENTITY (1,1) Commit
4
3840
by: Tryfon Gavriel | last post by:
Hi all I recently noticed when trying to optimise a major query of a chess website I am the webmaster of, that adding an order by for "gamenumber" which is a clustered index field as in for example "order by timeleft desc, gamenumber desc" actually speeded up the queries and reduced sql server 2000 timeouts. I have an ASP error log and I am fairly sure that a dramatic reduction in sql server timeouts is simply attributed to adding an...
5
2786
by: Paul | last post by:
Hi I have a table that currently has 466 columns and about 700,000 records. Adding a new DEFAULT column to this table takes a long time. It it a lot faster to recreate the table with the new columns and then copy all of the data across. As far as I am aware when you add a DEFAULT column the following happens:
2
1474
by: David Shadovitz | last post by:
I need to add a column to a table. This table holds several thousand records, has several indexes, and serves as the parent table to a few child tables. When I've done this in the past, it has taken quite a long time for the ALTER TABLE command to complete. So, what is the correct procedure for adding a column? Drop the indexes, add the column, and recreate the indexes?
47
3862
by: Albert | last post by:
So structures are useful to group variables, so you can to refer to a collection as a single entity. Wouldn't it be useful to also have the ability to collect variable and functions? Ask K&R say, C programs consist of variables to store the input and functions to manipulate them. This would make C object-oriented - how cool would that be? Are there any problems with adding the ability to have functions
8
3266
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of access, but doesn't mention primary keys. However, it seems logical to think that having no primary key means that when a user updates a record, the database has to do comparisons on multiple fields to identify the specific record being...
0
1198
by: okonita | last post by:
Hi all, I need to create one or two indexes on date columns to support MAX and MIN aggregate functions on a very large table and to make the SQL perform/run faster. I remember a group discussion sometime ago that creating an index on the date column ASCENDING or DESCENDING will be the thing to do. Is that still true? Does anyone have or know of a good discussion of the pros and cons of doing what I am trying to accomplish? Any...
0
8279
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8589
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.