How to get recommendations for indexes in ASE? - sybase-ase

I'm trying to optimize few queries that our application dynamically generates.
So far I'm using:
set option show_missing_stats on
However the setting only mentions missing statistics. Both MSSQL and Oracle give recommendations in terms of which indexes should be created to optimize query. Is there anything like that in Sybase ASE?

Sybase ASE unfortunately hasn't got a tool for indexes recommendation. As you said there is only show_missing_stats on Sybase ASE 15+.

Related

PDO + SqlAnywhere, its possible?

I would like use PHP PDO with SqlAnywhere, but don't have the driver on php site. Can I add a lib of sqlanywhere to use with PDO? ODBC is the last option.
I haven't tried this, but no one has answered in two days so I'll give a suggestion:
The PDO_MSSQL driver should in theory be able to talk to any FreeTDS back-end, including Sybase Server and perhaps even Sybase ASA. It may require you to do some hunting and reading blogs, forums, etc. to figure out the right freetds.conf entries to make it work.
However, the PDO_MSSQL driver is marked as "experimental" and AFAIK no one is maintaining it. Microsoft has abandoned it as well, since they're developing their own (non-PDO) PHP extension for SQL Server.*
So it's probably the better part of valor on your part to use PDO_ODBC.
* There was an effort a couple of years ago for Microsoft and other RDBMS vendors to cooperate to contribute code to the PDO project, but the core PHP community rebuffed the vendors over their requirement to use a contributor license agreement to ensure that the code in the project remain free. It was a sad episode.
A PDO SQL Anywhere driver has now been released here: http://pecl.php.net/package/PDO_SQLANYWHERE/
Yes, but you should modify the unixodbc library, the script: SQLExecute.c, otherwise will get the error : PERMISSION DENIED CREATE STORE PROCEDURE

Is it possible to connect PHP to SQL Server Compact Edition?

Is it possible to connect PHP to a SQL Server Compact Edition database? What would be the best driver?
I need it for a desktop application where SQL Server Express is too heavy.
Short Answer : No.
Long Answer : To my knowledge, unlike PostgreSQL / MySQL / MS-SQL, there is no native driver to connect PHP to SQL Server Compact Edition.
If you want to connect to it, your best bet is to use PHP ODBC connections to talk to a ODBC Driver connected to the SQL Compact server. But its pretty much a hack, and you'd be crazy to use this kind of thing for anything remotely important.
If you are worried about SQL Server Express being too heavy, use MySQL with MyISAM tables. It's pretty fast and lightweight. Emergent has a good checklist of things to configure / disable to make MySQL even faster and use less resources.
Relevant links :
MSDN Post asking the same question
Erik EJ's blog - SQL Compact with OLE DB
You could also consider SQLite:
http://www.devshed.com/c/a/PHP/Introduction-to-Using-SQLite-with-PHP-5/
I've used the php-odbtp to interface PHP (with ADOdb) to a MS SQL server and it runs well, even across remote networks.
It provides a tunneling protocol from a non-odbc platform (Linux) to a service installed on the Win32 machine to buffer requests to and from an ODBC connection. Bit of a pain to setup the first time, at least 2-3 years ago when I first used it. Should also work fine for Win32<->Win32 applications.
Not familiar with SQL C.E., but I'd imagine it supports an ODBC connection of some sort, and the standard T-SQL commands.
I wrote a php class that handles SQL compact edition files using the COM object of PHP.
This means it will only work on Windows based machines where the SQL Compact Edition runtime is installed.
You can download here (article is in German, link is at the bottom) with an example database file and script
http://www.klemmkeil.de/sql-compact-edition-sdf-mit-php-auslesen/
The question is Why? Why not just use an Express Version?
I must say that I'm curious, but I can't say that I've used a C.E. data base for anything outside of a .Net application that had the assemblies in the application folder.

Error:table exists in the database

why is it that using exec() in SYBASE ASE while dropping a table if it exists eliminates the Error:Table exists in the database. Why this error doesn't appear in Sybase IQ.
Because Sybase/SAP ASE and Sybase/SAP IQ are completely different products. What works in one does not have to work in the other. You might as well ask why a statement in PL/SQL works in Oracle but does not work in MySQL.

Tablefunc in Redshift to pivot table not supported?

I am trying to pivot a table in Redshift. This answer is instructive: https://stackoverflow.com/a/11751905/3063339
However, when I run the
CREATE EXTENSION tablefunc;
command I get the error:
syntax error at or near "EXTENSION"
Does redShift not support the syntax above, or tablefunc, or neither? If so, are there any RedShift functions that could act as a workaround? I am aware a table can be pivoted with basic postgresql commands SUM(CASE ...) etc. These do not scale well for large tables though. Many thanks.
CREATE EXTENSION was introduced with Postgres 9.1.
Amazon Redshift is based on PostgreSQL 8.0.2. Only selected features from later versions were implemented.
I does not seem like Redshift supports the extension tablefunc at all. You'll have to use CASE statements to emulate the functionality. Here is a related post on the AWS (that you already found in your comment).

PDO_OCI vs OCI8

I'm working on a new project and trying to determine if I should use PDO_OCI or oci8 for a database connection. Unfortunately I don't think anyone has really compared the two.
The information I have is as follows so that you know why I'm concerned about the choice. OCI8 is developed by Oracle(AFAIK) so this seems to be a solid choice. I prefer PDO but it doesn't look like the PDO_OCI extension has been updated in some time and its still marked as experimental on the PHP docs page.
If anyone can give me any thoughts on why you would / wouldn't use one or the other so that I can go into this with a little more of an understanding of which is better that would be great.
I was very nervous about using PDO_OCI with the Experimental note. However, I saw a major advantage to standardizing our database connections on PDO across the corporation because of its data abstraction.
I implemented some tests to make sure that data would make it to the database and that it could with stand the anticipated load. At this point it has processed about 15,000 records successfully.
The note on php.net about it says the names and function may change in a future release of PHP. I plan to test my implementation before we would upgrade to ensure the functionality hasn't changed, but we would probably do that any way.
I can say that it works well for us.
I copy answer from this thread:
Oracle, PDO_OCI vs OCI8
It seems to me that Oracle is not interested in developing a driver for PDO it's developing it's own driver to keep you close to oracle database... to oracle driver... etc. :)
As far as I've seen there is no problem if you can cope with max. texts of VARCHAR2 of 4000 CHARS. If you need CLOBs (and/or bigger) don't go with PDO_OCI.

Resources